diff --git a/src/librustc/arena.rs b/src/librustc/arena.rs index a52b883c3c3..b9126b619cd 100644 --- a/src/librustc/arena.rs +++ b/src/librustc/arena.rs @@ -79,6 +79,8 @@ macro_rules! arena_types { [few] resolve_lifetimes: rustc::middle::resolve_lifetime::ResolveLifetimes, [decode] generic_predicates: rustc::ty::GenericPredicates<'tcx>, [few] lint_levels: rustc::lint::LintLevelMap, + [few] stability_index: rustc::middle::stability::Index<'tcx>, + [few] features: syntax::feature_gate::Features, ], $tcx); ) } diff --git a/src/librustc/query/mod.rs b/src/librustc/query/mod.rs index 4cbda01e13f..759ee41f0e0 100644 --- a/src/librustc/query/mod.rs +++ b/src/librustc/query/mod.rs @@ -838,11 +838,11 @@ rustc_queries! { eval_always } - query stability_index(_: CrateNum) -> Lrc> { + query stability_index(_: CrateNum) -> &'tcx stability::Index<'tcx> { eval_always desc { "calculating the stability index for the local crate" } } - query all_crate_nums(_: CrateNum) -> Lrc> { + query all_crate_nums(_: CrateNum) -> &'tcx [CrateNum] { eval_always desc { "fetching all foreign CrateNum instances" } } @@ -1062,7 +1062,7 @@ rustc_queries! { desc { |tcx| "estimating size for `{}`", tcx.def_path_str(def.def_id()) } } - query features_query(_: CrateNum) -> Lrc { + query features_query(_: CrateNum) -> &'tcx feature_gate::Features { eval_always desc { "looking up enabled feature gates" } } diff --git a/src/librustc/ty/context.rs b/src/librustc/ty/context.rs index d8d1170fc3a..ad5fb53370a 100644 --- a/src/librustc/ty/context.rs +++ b/src/librustc/ty/context.rs @@ -1420,15 +1420,15 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { else { None } } - pub fn stability(self) -> Lrc> { + pub fn stability(self) -> &'gcx stability::Index<'gcx> { self.stability_index(LOCAL_CRATE) } - pub fn crates(self) -> Lrc> { + pub fn crates(self) -> &'gcx [CrateNum] { self.all_crate_nums(LOCAL_CRATE) } - pub fn features(self) -> Lrc { + pub fn features(self) -> &'gcx feature_gate::Features { self.features_query(LOCAL_CRATE) } @@ -3083,7 +3083,7 @@ pub fn provide(providers: &mut ty::query::Providers<'_>) { providers.stability_index = |tcx, cnum| { assert_eq!(cnum, LOCAL_CRATE); - Lrc::new(stability::Index::new(tcx)) + tcx.arena.alloc(stability::Index::new(tcx)) }; providers.lookup_stability = |tcx, id| { assert_eq!(id.krate, LOCAL_CRATE); @@ -3101,7 +3101,7 @@ pub fn provide(providers: &mut ty::query::Providers<'_>) { }; providers.all_crate_nums = |tcx, cnum| { assert_eq!(cnum, LOCAL_CRATE); - Lrc::new(tcx.cstore.crates_untracked()) + tcx.arena.alloc_slice(&tcx.cstore.crates_untracked()) }; providers.postorder_cnums = |tcx, cnum| { assert_eq!(cnum, LOCAL_CRATE); @@ -3113,7 +3113,7 @@ pub fn provide(providers: &mut ty::query::Providers<'_>) { }; providers.features_query = |tcx, cnum| { assert_eq!(cnum, LOCAL_CRATE); - Lrc::new(tcx.sess.features_untracked().clone()) + tcx.arena.alloc(tcx.sess.features_untracked().clone()) }; providers.is_panic_runtime = |tcx, cnum| { assert_eq!(cnum, LOCAL_CRATE); diff --git a/src/librustc_metadata/cstore_impl.rs b/src/librustc_metadata/cstore_impl.rs index 7ca1343a487..bdb29006a0e 100644 --- a/src/librustc_metadata/cstore_impl.rs +++ b/src/librustc_metadata/cstore_impl.rs @@ -322,7 +322,7 @@ pub fn provide<'tcx>(providers: &mut Providers<'tcx>) { // which is to say, its not deterministic in general. But // we believe that libstd is consistently assigned crate // num 1, so it should be enough to resolve #46112. - let mut crates: Vec = (*tcx.crates()).clone(); + let mut crates: Vec = (*tcx.crates()).to_owned(); crates.sort(); for &cnum in crates.iter() {