Skip to content

Commit 10ef70b

Browse files
committed
Update stability_index, all_crate_nums and features_query
1 parent 9dcc60b commit 10ef70b

File tree

4 files changed

+12
-10
lines changed

4 files changed

+12
-10
lines changed

src/librustc/arena.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,8 @@ macro_rules! arena_types {
7979
[few] resolve_lifetimes: rustc::middle::resolve_lifetime::ResolveLifetimes,
8080
[decode] generic_predicates: rustc::ty::GenericPredicates<'tcx>,
8181
[few] lint_levels: rustc::lint::LintLevelMap,
82+
[few] stability_index: rustc::middle::stability::Index<'tcx>,
83+
[few] features: syntax::feature_gate::Features,
8284
], $tcx);
8385
)
8486
}

src/librustc/query/mod.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -838,11 +838,11 @@ rustc_queries! {
838838
eval_always
839839
}
840840

841-
query stability_index(_: CrateNum) -> Lrc<stability::Index<'tcx>> {
841+
query stability_index(_: CrateNum) -> &'tcx stability::Index<'tcx> {
842842
eval_always
843843
desc { "calculating the stability index for the local crate" }
844844
}
845-
query all_crate_nums(_: CrateNum) -> Lrc<Vec<CrateNum>> {
845+
query all_crate_nums(_: CrateNum) -> &'tcx [CrateNum] {
846846
eval_always
847847
desc { "fetching all foreign CrateNum instances" }
848848
}
@@ -1062,7 +1062,7 @@ rustc_queries! {
10621062
desc { |tcx| "estimating size for `{}`", tcx.def_path_str(def.def_id()) }
10631063
}
10641064

1065-
query features_query(_: CrateNum) -> Lrc<feature_gate::Features> {
1065+
query features_query(_: CrateNum) -> &'tcx feature_gate::Features {
10661066
eval_always
10671067
desc { "looking up enabled feature gates" }
10681068
}

src/librustc/ty/context.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1420,15 +1420,15 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
14201420
else { None }
14211421
}
14221422

1423-
pub fn stability(self) -> Lrc<stability::Index<'tcx>> {
1423+
pub fn stability(self) -> &'gcx stability::Index<'gcx> {
14241424
self.stability_index(LOCAL_CRATE)
14251425
}
14261426

1427-
pub fn crates(self) -> Lrc<Vec<CrateNum>> {
1427+
pub fn crates(self) -> &'gcx [CrateNum] {
14281428
self.all_crate_nums(LOCAL_CRATE)
14291429
}
14301430

1431-
pub fn features(self) -> Lrc<feature_gate::Features> {
1431+
pub fn features(self) -> &'gcx feature_gate::Features {
14321432
self.features_query(LOCAL_CRATE)
14331433
}
14341434

@@ -3083,7 +3083,7 @@ pub fn provide(providers: &mut ty::query::Providers<'_>) {
30833083

30843084
providers.stability_index = |tcx, cnum| {
30853085
assert_eq!(cnum, LOCAL_CRATE);
3086-
Lrc::new(stability::Index::new(tcx))
3086+
tcx.arena.alloc(stability::Index::new(tcx))
30873087
};
30883088
providers.lookup_stability = |tcx, id| {
30893089
assert_eq!(id.krate, LOCAL_CRATE);
@@ -3101,7 +3101,7 @@ pub fn provide(providers: &mut ty::query::Providers<'_>) {
31013101
};
31023102
providers.all_crate_nums = |tcx, cnum| {
31033103
assert_eq!(cnum, LOCAL_CRATE);
3104-
Lrc::new(tcx.cstore.crates_untracked())
3104+
tcx.arena.alloc_slice(&tcx.cstore.crates_untracked())
31053105
};
31063106
providers.postorder_cnums = |tcx, cnum| {
31073107
assert_eq!(cnum, LOCAL_CRATE);
@@ -3113,7 +3113,7 @@ pub fn provide(providers: &mut ty::query::Providers<'_>) {
31133113
};
31143114
providers.features_query = |tcx, cnum| {
31153115
assert_eq!(cnum, LOCAL_CRATE);
3116-
Lrc::new(tcx.sess.features_untracked().clone())
3116+
tcx.arena.alloc(tcx.sess.features_untracked().clone())
31173117
};
31183118
providers.is_panic_runtime = |tcx, cnum| {
31193119
assert_eq!(cnum, LOCAL_CRATE);

src/librustc_metadata/cstore_impl.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,7 @@ pub fn provide<'tcx>(providers: &mut Providers<'tcx>) {
322322
// which is to say, its not deterministic in general. But
323323
// we believe that libstd is consistently assigned crate
324324
// num 1, so it should be enough to resolve #46112.
325-
let mut crates: Vec<CrateNum> = (*tcx.crates()).clone();
325+
let mut crates: Vec<CrateNum> = (*tcx.crates()).to_owned();
326326
crates.sort();
327327

328328
for &cnum in crates.iter() {

0 commit comments

Comments
 (0)