mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-22 23:04:33 +00:00
Update stability_index, all_crate_nums and features_query
This commit is contained in:
parent
9dcc60b081
commit
10ef70bb68
@ -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);
|
||||
)
|
||||
}
|
||||
|
@ -838,11 +838,11 @@ rustc_queries! {
|
||||
eval_always
|
||||
}
|
||||
|
||||
query stability_index(_: CrateNum) -> Lrc<stability::Index<'tcx>> {
|
||||
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<Vec<CrateNum>> {
|
||||
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<feature_gate::Features> {
|
||||
query features_query(_: CrateNum) -> &'tcx feature_gate::Features {
|
||||
eval_always
|
||||
desc { "looking up enabled feature gates" }
|
||||
}
|
||||
|
@ -1420,15 +1420,15 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
|
||||
else { None }
|
||||
}
|
||||
|
||||
pub fn stability(self) -> Lrc<stability::Index<'tcx>> {
|
||||
pub fn stability(self) -> &'gcx stability::Index<'gcx> {
|
||||
self.stability_index(LOCAL_CRATE)
|
||||
}
|
||||
|
||||
pub fn crates(self) -> Lrc<Vec<CrateNum>> {
|
||||
pub fn crates(self) -> &'gcx [CrateNum] {
|
||||
self.all_crate_nums(LOCAL_CRATE)
|
||||
}
|
||||
|
||||
pub fn features(self) -> Lrc<feature_gate::Features> {
|
||||
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);
|
||||
|
@ -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<CrateNum> = (*tcx.crates()).clone();
|
||||
let mut crates: Vec<CrateNum> = (*tcx.crates()).to_owned();
|
||||
crates.sort();
|
||||
|
||||
for &cnum in crates.iter() {
|
||||
|
Loading…
Reference in New Issue
Block a user