diff --git a/compiler/rustc_metadata/src/rmeta/encoder.rs b/compiler/rustc_metadata/src/rmeta/encoder.rs index 5cd5fc3503845..f3c9b1a505a43 100644 --- a/compiler/rustc_metadata/src/rmeta/encoder.rs +++ b/compiler/rustc_metadata/src/rmeta/encoder.rs @@ -1407,9 +1407,15 @@ impl<'a, 'tcx> EncodeContext<'a, 'tcx> { record!(self.tables.object_lifetime_default[def_id] <- default); } if let DefKind::Trait = def_kind { + record!(self.tables.trait_def[def_id] <- self.tcx.trait_def(def_id)); record!(self.tables.super_predicates_of[def_id] <- self.tcx.super_predicates_of(def_id)); + + let module_children = self.tcx.module_children_local(local_id); + record_array!(self.tables.module_children_non_reexports[def_id] <- + module_children.iter().map(|child| child.res.def_id().index)); } if let DefKind::TraitAlias = def_kind { + record!(self.tables.trait_def[def_id] <- self.tcx.trait_def(def_id)); record!(self.tables.super_predicates_of[def_id] <- self.tcx.super_predicates_of(def_id)); record!(self.tables.implied_predicates_of[def_id] <- self.tcx.implied_predicates_of(def_id)); } @@ -1723,18 +1729,10 @@ impl<'a, 'tcx> EncodeContext<'a, 'tcx> { } } } - hir::ItemKind::Trait(..) => { - record!(self.tables.trait_def[def_id] <- self.tcx.trait_def(def_id)); - - let module_children = self.tcx.module_children_local(item.owner_id.def_id); - record_array!(self.tables.module_children_non_reexports[def_id] <- - module_children.iter().map(|child| child.res.def_id().index)); - } - hir::ItemKind::TraitAlias(..) => { - record!(self.tables.trait_def[def_id] <- self.tcx.trait_def(def_id)); - } hir::ItemKind::ExternCrate(_) | hir::ItemKind::Use(..) + | hir::ItemKind::Trait(..) + | hir::ItemKind::TraitAlias(..) | hir::ItemKind::Static(..) | hir::ItemKind::Const(..) | hir::ItemKind::Enum(..)