Skip to content
Permalink
Browse files

Update crate_variances and inferred_outlives_crate

  • Loading branch information...
Zoxc committed May 20, 2019
1 parent a58999c commit d46e732e393a01884115e4506968606bd4da0d17
@@ -99,6 +99,8 @@ macro_rules! arena_types {
[few] reachable_non_generics: rustc::util::nodemap::DefIdMap<
rustc::middle::exported_symbols::SymbolExportLevel
>,
[few] crate_variances: rustc::ty::CrateVariancesMap<'tcx>,
[few] inferred_outlives_crate: rustc::ty::CratePredicatesMap<'tcx>,
], $tcx);
)
}
@@ -244,7 +244,7 @@ rustc_queries! {
query static_mutability(_: DefId) -> Option<hir::Mutability> {}

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

@@ -255,7 +255,7 @@ rustc_queries! {
TypeChecking {
/// Maps from thee `DefId` of a type to its (inferred) outlives.
query inferred_outlives_crate(_: CrateNum)
-> Lrc<ty::CratePredicatesMap<'tcx>> {
-> &'tcx ty::CratePredicatesMap<'tcx> {
desc { "computing the inferred outlives predicates for items in this crate" }
}
}
@@ -4,7 +4,6 @@ use rustc::hir::def_id::{CrateNum, DefId, LOCAL_CRATE};
use rustc::ty::query::Providers;
use rustc::ty::subst::UnpackedKind;
use rustc::ty::{self, CratePredicatesMap, TyCtxt};
use rustc_data_structures::sync::Lrc;
use syntax::symbol::sym;

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

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

Lrc::new(ty::CratePredicatesMap {
tcx.arena.alloc(ty::CratePredicatesMap {
predicates,
})
}
@@ -9,7 +9,6 @@ use hir::Node;
use rustc::hir::def_id::{CrateNum, DefId, LOCAL_CRATE};
use rustc::ty::{self, CrateVariancesMap, TyCtxt};
use rustc::ty::query::Providers;
use rustc_data_structures::sync::Lrc;

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

fn crate_variances<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, crate_num: CrateNum)
-> Lrc<CrateVariancesMap<'tcx>> {
-> &'tcx CrateVariancesMap<'tcx> {
assert_eq!(crate_num, LOCAL_CRATE);
let mut arena = arena::TypedArena::default();
let terms_cx = terms::determine_parameters_to_be_inferred(tcx, &mut arena);
let constraints_cx = constraints::add_constraints_from_crate(terms_cx);
Lrc::new(solve::solve_constraints(constraints_cx))
tcx.arena.alloc(solve::solve_constraints(constraints_cx))
}

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

0 comments on commit d46e732

Please sign in to comment.
You can’t perform that action at this time.