Skip to content

Commit d46e732

Browse files
committed
Update crate_variances and inferred_outlives_crate
1 parent a58999c commit d46e732

File tree

4 files changed

+8
-8
lines changed

4 files changed

+8
-8
lines changed

src/librustc/arena.rs

+2
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,8 @@ macro_rules! arena_types {
9999
[few] reachable_non_generics: rustc::util::nodemap::DefIdMap<
100100
rustc::middle::exported_symbols::SymbolExportLevel
101101
>,
102+
[few] crate_variances: rustc::ty::CrateVariancesMap<'tcx>,
103+
[few] inferred_outlives_crate: rustc::ty::CratePredicatesMap<'tcx>,
102104
], $tcx);
103105
)
104106
}

src/librustc/query/mod.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ rustc_queries! {
244244
query static_mutability(_: DefId) -> Option<hir::Mutability> {}
245245

246246
/// Gets a map with the variance of every item; use `item_variance` instead.
247-
query crate_variances(_: CrateNum) -> Lrc<ty::CrateVariancesMap<'tcx>> {
247+
query crate_variances(_: CrateNum) -> &'tcx ty::CrateVariancesMap<'tcx> {
248248
desc { "computing the variances for items in this crate" }
249249
}
250250

@@ -255,7 +255,7 @@ rustc_queries! {
255255
TypeChecking {
256256
/// Maps from thee `DefId` of a type to its (inferred) outlives.
257257
query inferred_outlives_crate(_: CrateNum)
258-
-> Lrc<ty::CratePredicatesMap<'tcx>> {
258+
-> &'tcx ty::CratePredicatesMap<'tcx> {
259259
desc { "computing the inferred outlives predicates for items in this crate" }
260260
}
261261
}

src/librustc_typeck/outlives/mod.rs

+2-3
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ use rustc::hir::def_id::{CrateNum, DefId, LOCAL_CRATE};
44
use rustc::ty::query::Providers;
55
use rustc::ty::subst::UnpackedKind;
66
use rustc::ty::{self, CratePredicatesMap, TyCtxt};
7-
use rustc_data_structures::sync::Lrc;
87
use syntax::symbol::sym;
98

109
mod explicit;
@@ -74,7 +73,7 @@ fn inferred_outlives_of<'a, 'tcx>(
7473
fn inferred_outlives_crate<'tcx>(
7574
tcx: TyCtxt<'_, 'tcx, 'tcx>,
7675
crate_num: CrateNum,
77-
) -> Lrc<CratePredicatesMap<'tcx>> {
76+
) -> &'tcx CratePredicatesMap<'tcx> {
7877
assert_eq!(crate_num, LOCAL_CRATE);
7978

8079
// Compute a map from each struct/enum/union S to the **explicit**
@@ -120,7 +119,7 @@ fn inferred_outlives_crate<'tcx>(
120119
(def_id, &*predicates)
121120
}).collect();
122121

123-
Lrc::new(ty::CratePredicatesMap {
122+
tcx.arena.alloc(ty::CratePredicatesMap {
124123
predicates,
125124
})
126125
}

src/librustc_typeck/variance/mod.rs

+2-3
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ use hir::Node;
99
use rustc::hir::def_id::{CrateNum, DefId, LOCAL_CRATE};
1010
use rustc::ty::{self, CrateVariancesMap, TyCtxt};
1111
use rustc::ty::query::Providers;
12-
use rustc_data_structures::sync::Lrc;
1312

1413
/// Defines the `TermsContext` basically houses an arena where we can
1514
/// allocate terms.
@@ -36,12 +35,12 @@ pub fn provide(providers: &mut Providers<'_>) {
3635
}
3736

3837
fn crate_variances<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, crate_num: CrateNum)
39-
-> Lrc<CrateVariancesMap<'tcx>> {
38+
-> &'tcx CrateVariancesMap<'tcx> {
4039
assert_eq!(crate_num, LOCAL_CRATE);
4140
let mut arena = arena::TypedArena::default();
4241
let terms_cx = terms::determine_parameters_to_be_inferred(tcx, &mut arena);
4342
let constraints_cx = constraints::add_constraints_from_crate(terms_cx);
44-
Lrc::new(solve::solve_constraints(constraints_cx))
43+
tcx.arena.alloc(solve::solve_constraints(constraints_cx))
4544
}
4645

4746
fn variances_of<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, item_def_id: DefId)

0 commit comments

Comments
 (0)