+ providers.mir_keys = mir_keys;
+}
+
+fn mir_keys<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, krate: CrateNum)
+ -> Rc<DefIdSet> {
+ assert_eq!(krate, LOCAL_CRATE);
+
+ let mut set = DefIdSet();
+
+ // All body-owners have MIR associated with them.
+ set.extend(tcx.body_owners());
+
+ // Additionally, tuple struct/variant constructors have MIR, but
+ // they don't have a BodyId, so we need to build them separately.
+ struct GatherCtors<'a, 'tcx: 'a> {
+ tcx: TyCtxt<'a, 'tcx, 'tcx>,
+ set: &'a mut DefIdSet,
+ }
+ impl<'a, 'tcx> Visitor<'tcx> for GatherCtors<'a, 'tcx> {
+ fn visit_variant_data(&mut self,
+ v: &'tcx hir::VariantData,
+ _: ast::Name,
+ _: &'tcx hir::Generics,
+ _: ast::NodeId,
+ _: Span) {
+ if let hir::VariantData::Tuple(_, node_id) = *v {
+ self.set.insert(self.tcx.hir.local_def_id(node_id));
+ }
+ intravisit::walk_struct_def(self, v)
+ }
+ fn nested_visit_map<'b>(&'b mut self) -> NestedVisitorMap<'b, 'tcx> {
+ NestedVisitorMap::None
+ }
+ }
+ tcx.hir.krate().visit_all_item_likes(&mut GatherCtors {
+ tcx: tcx,
+ set: &mut set,
+ }.as_deep_visitor());
+
+ Rc::new(set)