about summary refs log tree commit diff
diff options
context:
space:
mode:
authorCamille GILLOT <gillot.camille@gmail.com>2022-07-03 22:10:14 +0200
committerCamille GILLOT <gillot.camille@gmail.com>2023-06-27 16:50:34 +0000
commit45a9a5460ffafb6a2448083d2e1bb24fd63ea450 (patch)
treee7a32b8fd5f0e18dada2062c92018207570b44b8
parent1a9d34fd81c68bfc8e468d9b7665294f5956af03 (diff)
downloadrust-45a9a5460ffafb6a2448083d2e1bb24fd63ea450.tar.gz
rust-45a9a5460ffafb6a2448083d2e1bb24fd63ea450.zip
Encode Trait info in def-id loop.
-rw-r--r--compiler/rustc_metadata/src/rmeta/encoder.rs18
1 files changed, 8 insertions, 10 deletions
diff --git a/compiler/rustc_metadata/src/rmeta/encoder.rs b/compiler/rustc_metadata/src/rmeta/encoder.rs
index 5cd5fc35038..f3c9b1a505a 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(..)