@@ -63,7 +63,6 @@ use crate::arena::Arena;
6363use crate :: dep_graph:: { DepGraph , DepKindStruct } ;
6464use crate :: infer:: canonical:: { CanonicalParamEnvCache , CanonicalVarKind , CanonicalVarKinds } ;
6565use crate :: lint:: lint_level;
66- use crate :: metadata:: ModChild ;
6766use crate :: middle:: codegen_fn_attrs:: { CodegenFnAttrs , TargetFeature } ;
6867use crate :: middle:: { resolve_bound_vars, stability} ;
6968use crate :: mir:: interpret:: { self , Allocation , ConstAllocation } ;
@@ -2081,9 +2080,8 @@ impl<'tcx> TyCtxt<'tcx> {
20812080 }
20822081
20832082 pub fn iter_local_def_id ( self ) -> impl Iterator < Item = LocalDefId > {
2084- // Create a dependency to the red node to be sure we re-execute this when the amount of
2085- // definitions change.
2086- self . dep_graph . read_index ( DepNodeIndex :: FOREVER_RED_NODE ) ;
2083+ // Depend on the `analysis` query to ensure compilation if finished.
2084+ self . ensure_ok ( ) . analysis ( ( ) ) ;
20872085
20882086 let definitions = & self . untracked . definitions ;
20892087 gen {
@@ -2103,9 +2101,8 @@ impl<'tcx> TyCtxt<'tcx> {
21032101 }
21042102
21052103 pub fn def_path_table ( self ) -> & ' tcx rustc_hir:: definitions:: DefPathTable {
2106- // Create a dependency to the crate to be sure we re-execute this when the amount of
2107- // definitions change.
2108- self . dep_graph . read_index ( DepNodeIndex :: FOREVER_RED_NODE ) ;
2104+ // Depend on the `analysis` query to ensure compilation if finished.
2105+ self . ensure_ok ( ) . analysis ( ( ) ) ;
21092106
21102107 // Freeze definitions once we start iterating on them, to prevent adding new ones
21112108 // while iterating. If some query needs to add definitions, it should be `ensure`d above.
@@ -3372,19 +3369,6 @@ impl<'tcx> TyCtxt<'tcx> {
33723369 self . opt_rpitit_info ( def_id) . is_some ( )
33733370 }
33743371
3375- /// Named module children from all kinds of items, including imports.
3376- /// In addition to regular items this list also includes struct and variant constructors, and
3377- /// items inside `extern {}` blocks because all of them introduce names into parent module.
3378- ///
3379- /// Module here is understood in name resolution sense - it can be a `mod` item,
3380- /// or a crate root, or an enum, or a trait.
3381- ///
3382- /// This is not a query, making it a query causes perf regressions
3383- /// (probably due to hashing spans in `ModChild`ren).
3384- pub fn module_children_local ( self , def_id : LocalDefId ) -> & ' tcx [ ModChild ] {
3385- self . resolutions ( ( ) ) . module_children . get ( & def_id) . map_or ( & [ ] , |v| & v[ ..] )
3386- }
3387-
33883372 pub fn resolver_for_lowering ( self ) -> & ' tcx Steal < ( ty:: ResolverAstLowering , Arc < ast:: Crate > ) > {
33893373 self . resolver_for_lowering_raw ( ( ) ) . 0
33903374 }
@@ -3436,6 +3420,8 @@ pub struct DeducedParamAttrs {
34363420}
34373421
34383422pub fn provide ( providers : & mut Providers ) {
3423+ providers. module_children_local =
3424+ |tcx, def_id| tcx. resolutions ( ( ) ) . module_children . get ( & def_id) . map_or ( & [ ] , |v| & v[ ..] ) ;
34393425 providers. maybe_unused_trait_imports =
34403426 |tcx, ( ) | & tcx. resolutions ( ( ) ) . maybe_unused_trait_imports ;
34413427 providers. names_imported_by_glob_use = |tcx, id| {
0 commit comments