@@ -63,7 +63,6 @@ use crate::arena::Arena;
63
63
use crate :: dep_graph:: { DepGraph , DepKindStruct } ;
64
64
use crate :: infer:: canonical:: { CanonicalParamEnvCache , CanonicalVarKind , CanonicalVarKinds } ;
65
65
use crate :: lint:: lint_level;
66
- use crate :: metadata:: ModChild ;
67
66
use crate :: middle:: codegen_fn_attrs:: { CodegenFnAttrs , TargetFeature } ;
68
67
use crate :: middle:: { resolve_bound_vars, stability} ;
69
68
use crate :: mir:: interpret:: { self , Allocation , ConstAllocation } ;
@@ -2081,9 +2080,8 @@ impl<'tcx> TyCtxt<'tcx> {
2081
2080
}
2082
2081
2083
2082
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 ( ( ) ) ;
2087
2085
2088
2086
let definitions = & self . untracked . definitions ;
2089
2087
gen {
@@ -2103,9 +2101,8 @@ impl<'tcx> TyCtxt<'tcx> {
2103
2101
}
2104
2102
2105
2103
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 ( ( ) ) ;
2109
2106
2110
2107
// Freeze definitions once we start iterating on them, to prevent adding new ones
2111
2108
// while iterating. If some query needs to add definitions, it should be `ensure`d above.
@@ -3372,19 +3369,6 @@ impl<'tcx> TyCtxt<'tcx> {
3372
3369
self . opt_rpitit_info ( def_id) . is_some ( )
3373
3370
}
3374
3371
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
-
3388
3372
pub fn resolver_for_lowering ( self ) -> & ' tcx Steal < ( ty:: ResolverAstLowering , Arc < ast:: Crate > ) > {
3389
3373
self . resolver_for_lowering_raw ( ( ) ) . 0
3390
3374
}
@@ -3436,6 +3420,8 @@ pub struct DeducedParamAttrs {
3436
3420
}
3437
3421
3438
3422
pub 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[ ..] ) ;
3439
3425
providers. maybe_unused_trait_imports =
3440
3426
|tcx, ( ) | & tcx. resolutions ( ( ) ) . maybe_unused_trait_imports ;
3441
3427
providers. names_imported_by_glob_use = |tcx, id| {
0 commit comments