@@ -215,7 +215,8 @@ rustc_queries! {
215215        desc {  |tcx| "elaborating item bounds for `{}`" ,  tcx. def_path_str( key)  } 
216216    } 
217217
218-     query native_libraries( _:  CrateNum )  -> Lrc <Vec <NativeLib >> { 
218+     query native_libraries( _:  CrateNum )  -> Vec <NativeLib > { 
219+         storage( ArenaCacheSelector <' tcx>) 
219220        desc {  "looking up the native libraries of a linked crate"  } 
220221        separate_provide_extern
221222    } 
@@ -254,6 +255,7 @@ rustc_queries! {
254255    /// Create a THIR tree for debugging. 
255256( key:  ty:: WithOptConstParam <LocalDefId >)  -> String  { 
256257        no_hash
258+         storage( ArenaCacheSelector <' tcx>) 
257259        desc {  |tcx| "constructing THIR tree for `{}`" ,  tcx. def_path_str( key. did. to_def_id( ) )  } 
258260    } 
259261
@@ -368,6 +370,7 @@ rustc_queries! {
368370    query symbols_for_closure_captures( 
369371        key:  ( LocalDefId ,  DefId ) 
370372    )  -> Vec <rustc_span:: Symbol > { 
373+         storage( ArenaCacheSelector <' tcx>) 
371374        desc { 
372375            |tcx| "symbols for captures of closure `{}` in `{}`" , 
373376            tcx. def_path_str( key. 1 ) , 
@@ -538,7 +541,7 @@ rustc_queries! {
538541
539542    query adt_dtorck_constraint( 
540543        key:  DefId 
541-     )  -> Result <DtorckConstraint <' tcx>,  NoSolution > { 
544+     )  -> Result <& ' tcx  DtorckConstraint <' tcx>,  NoSolution > { 
542545        desc {  |tcx| "computing drop-check constraints for `{}`" ,  tcx. def_path_str( key)  } 
543546    } 
544547
@@ -646,8 +649,8 @@ rustc_queries! {
646649/// The map returned for `tcx.impl_item_implementor_ids(impl_id)` would be 
647650///`{ trait_f: impl_f, trait_g: impl_g }` 
648651( impl_id:  DefId )  -> FxHashMap <DefId ,  DefId > { 
649-         desc {  |tcx| "comparing impl items against trait for {}" ,  tcx. def_path_str( impl_id)  } 
650652        storage( ArenaCacheSelector <' tcx>) 
653+         desc {  |tcx| "comparing impl items against trait for {}" ,  tcx. def_path_str( impl_id)  } 
651654    } 
652655
653656    /// Given an `impl_id`, return the trait it implements. 
@@ -1042,6 +1045,7 @@ rustc_queries! {
10421045    /// Gets the rendered value of the specified constant or associated constant. 
10431046/// Used by rustdoc. 
10441047( def_id:  DefId )  -> String  { 
1048+         storage( ArenaCacheSelector <' tcx>) 
10451049        desc {  |tcx| "rendering constant intializer of `{}`" ,  tcx. def_path_str( def_id)  } 
10461050        separate_provide_extern
10471051    } 
@@ -1091,7 +1095,7 @@ rustc_queries! {
10911095
10921096    query codegen_fulfill_obligation( 
10931097        key:  ( ty:: ParamEnv <' tcx>,  ty:: PolyTraitRef <' tcx>) 
1094-     )  -> Result <ImplSource <' tcx,  ( ) >,  ErrorReported > { 
1098+     )  -> Result <& ' tcx  ImplSource <' tcx,  ( ) >,  ErrorReported > { 
10951099        cache_on_disk_if {  true  } 
10961100        desc {  |tcx|
10971101            "checking if `{}` fulfills its obligations" , 
@@ -1237,6 +1241,7 @@ rustc_queries! {
12371241    } 
12381242
12391243    query dependency_formats( _:  ( ) )  -> Lrc <crate :: middle:: dependency_format:: Dependencies > { 
1244+         storage( ArenaCacheSelector <' tcx>) 
12401245        desc {  "get the linkage format of all dependencies"  } 
12411246    } 
12421247
@@ -1369,13 +1374,15 @@ rustc_queries! {
13691374/// You likely want to call `Instance::upstream_monomorphization()` 
13701375/// instead of invoking this query directly. 
13711376( def_id:  DefId ) 
1372-         -> Option <& ' tcx FxHashMap <SubstsRef <' tcx>,  CrateNum >>  { 
1373-             desc  {  |tcx| 
1374-                  "collecting available upstream monomorphizations for `{}`" , 
1375-                  tcx. def_path_str ( def_id ) , 
1376-             } 
1377-             separate_provide_extern 
1377+         -> Option <& ' tcx FxHashMap <SubstsRef <' tcx>,  CrateNum >>
1378+     { 
1379+         storage ( ArenaCacheSelector < ' tcx> ) 
1380+         desc  {  | tcx| 
1381+             "collecting available upstream monomorphizations for `{}`" , 
1382+             tcx . def_path_str ( def_id ) , 
13781383        } 
1384+         separate_provide_extern
1385+     } 
13791386
13801387    /// Returns the upstream crate that exports drop-glue for the given 
13811388/// type (`substs` is expected to be a single-item list containing the 
@@ -1396,7 +1403,8 @@ rustc_queries! {
13961403        desc {  "available upstream drop-glue for `{:?}`" ,  substs } 
13971404    } 
13981405
1399-     query foreign_modules( _:  CrateNum )  -> Lrc <FxHashMap <DefId ,  ForeignModule >> { 
1406+     query foreign_modules( _:  CrateNum )  -> FxHashMap <DefId ,  ForeignModule > { 
1407+         storage( ArenaCacheSelector <' tcx>) 
14001408        desc {  "looking up the foreign modules of a linked crate"  } 
14011409        separate_provide_extern
14021410    } 
@@ -1422,11 +1430,13 @@ rustc_queries! {
14221430        separate_provide_extern
14231431    } 
14241432    query extra_filename( _:  CrateNum )  -> String  { 
1433+         storage( ArenaCacheSelector <' tcx>) 
14251434        eval_always
14261435        desc {  "looking up the extra filename for a crate"  } 
14271436        separate_provide_extern
14281437    } 
14291438    query crate_extern_paths( _:  CrateNum )  -> Vec <PathBuf > { 
1439+         storage( ArenaCacheSelector <' tcx>) 
14301440        eval_always
14311441        desc {  "looking up the paths for extern crates"  } 
14321442        separate_provide_extern
@@ -1478,8 +1488,7 @@ rustc_queries! {
14781488/// for each parameter if a trait object were to be passed for that parameter. 
14791489/// For example, for `struct Foo<'a, T, U>`, this would be `['static, 'static]`. 
14801490/// For `struct Foo<'a, T: 'a, U>`, this would instead be `['a, 'static]`. 
1481- ( _:  LocalDefId ) 
1482-         -> Option <Vec <ObjectLifetimeDefault >> { 
1491+ ( _:  LocalDefId )  -> Option <& ' tcx [ ObjectLifetimeDefault ] > { 
14831492        desc {  "looking up lifetime defaults for a region on an item"  } 
14841493    } 
14851494    query late_bound_vars_map( _:  LocalDefId ) 
@@ -1488,6 +1497,7 @@ rustc_queries! {
14881497    } 
14891498
14901499    query lifetime_scope_map( _:  LocalDefId )  -> Option <FxHashMap <ItemLocalId ,  LifetimeScopeForPath >> { 
1500+         storage( ArenaCacheSelector <' tcx>) 
14911501        desc {  "finds the lifetime scope for an HirId of a PathSegment"  } 
14921502    } 
14931503
@@ -1501,7 +1511,7 @@ rustc_queries! {
15011511/// check whether the forest is empty. 
15021512( 
15031513        key:  ty:: ParamEnvAnd <' tcx,  Ty <' tcx>>
1504-     )  -> ty:: inhabitedness:: DefIdForest  { 
1514+     )  -> ty:: inhabitedness:: DefIdForest < ' tcx>  { 
15051515        desc {  "computing the inhabitedness of `{:?}`" ,  key } 
15061516        remap_env_constness
15071517    } 
@@ -1566,7 +1576,8 @@ rustc_queries! {
15661576        desc {  "calculating the missing lang items in a crate"  } 
15671577        separate_provide_extern
15681578    } 
1569-     query visible_parent_map( _:  ( ) )  -> Lrc <DefIdMap <DefId >> { 
1579+     query visible_parent_map( _:  ( ) )  -> DefIdMap <DefId > { 
1580+         storage( ArenaCacheSelector <' tcx>) 
15701581        desc {  "calculating the visible parent map"  } 
15711582    } 
15721583    query trimmed_def_paths( _:  ( ) )  -> FxHashMap <DefId ,  Symbol > { 
@@ -1579,6 +1590,7 @@ rustc_queries! {
15791590        separate_provide_extern
15801591    } 
15811592    query used_crate_source( _:  CrateNum )  -> Lrc <CrateSource > { 
1593+         storage( ArenaCacheSelector <' tcx>) 
15821594        eval_always
15831595        desc {  "looking at the source for a crate"  } 
15841596        separate_provide_extern
@@ -1669,7 +1681,11 @@ rustc_queries! {
16691681        desc {  "optimization level used by backend"  } 
16701682    } 
16711683
1672-     query output_filenames( _:  ( ) )  -> Arc <OutputFilenames > { 
1684+     /// Return the filenames where output artefacts shall be stored. 
1685+ /// 
1686+ /// This query returns an `&Arc` because codegen backends need the value even after the `TyCtxt` 
1687+ /// has been destroyed. 
1688+ ( _:  ( ) )  -> & ' tcx Arc <OutputFilenames > { 
16731689        eval_always
16741690        desc {  "output_filenames"  } 
16751691    } 
@@ -1911,6 +1927,7 @@ rustc_queries! {
19111927/// all of the cases that the normal `ty::Ty`-based wfcheck does. This is fine, 
19121928/// because the `ty::Ty`-based wfcheck is always run. 
19131929( key:  ( ty:: Predicate <' tcx>,  traits:: WellFormedLoc ) )  -> Option <traits:: ObligationCause <' tcx>> { 
1930+         storage( ArenaCacheSelector <' tcx>) 
19141931        eval_always
19151932        no_hash
19161933        desc {  "performing HIR wf-checking for predicate {:?} at item {:?}" ,  key. 0 ,  key. 1  } 
0 commit comments