From 100a4f5699eda98ad642adfb390cc8b8365c8aae Mon Sep 17 00:00:00 2001 From: Michael Woerister Date: Thu, 5 May 2016 14:29:02 -0400 Subject: [PATCH] trans: Make normalize_and_test_predicates() not depend on CrateContext. --- src/librustc_trans/collector.rs | 2 +- src/librustc_trans/common.rs | 7 +++---- src/librustc_trans/meth.rs | 2 +- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/librustc_trans/collector.rs b/src/librustc_trans/collector.rs index cb94c2a2cce8..e27dd335e6f7 100644 --- a/src/librustc_trans/collector.rs +++ b/src/librustc_trans/collector.rs @@ -1194,7 +1194,7 @@ fn create_trans_items_for_default_impls<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>, assert!(mth.is_provided); let predicates = mth.method.predicates.predicates.subst(tcx, &mth.substs); - if !normalize_and_test_predicates(ccx, predicates.into_vec()) { + if !normalize_and_test_predicates(ccx.tcx(), predicates.into_vec()) { continue; } diff --git a/src/librustc_trans/common.rs b/src/librustc_trans/common.rs index 70348cf35e5f..0684355cb106 100644 --- a/src/librustc_trans/common.rs +++ b/src/librustc_trans/common.rs @@ -1129,14 +1129,13 @@ pub fn fulfill_obligation<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>, /// returns false, then either normalize encountered an error or one /// of the predicates did not hold. Used when creating vtables to /// check for unsatisfiable methods. -pub fn normalize_and_test_predicates<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>, - predicates: Vec>) - -> bool +pub fn normalize_and_test_predicates<'tcx>(tcx: &TyCtxt<'tcx>, + predicates: Vec>) + -> bool { debug!("normalize_and_test_predicates(predicates={:?})", predicates); - let tcx = ccx.tcx(); let infcx = infer::normalizing_infer_ctxt(tcx, &tcx.tables, ProjectionMode::Any); let mut selcx = SelectionContext::new(&infcx); let mut fulfill_cx = traits::FulfillmentContext::new(); diff --git a/src/librustc_trans/meth.rs b/src/librustc_trans/meth.rs index 9e5476ae80d4..b351394950b5 100644 --- a/src/librustc_trans/meth.rs +++ b/src/librustc_trans/meth.rs @@ -287,7 +287,7 @@ pub fn get_vtable_methods<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>, // try and trans it, in that case. Issue #23435. if mth.is_provided { let predicates = mth.method.predicates.predicates.subst(tcx, &mth.substs); - if !normalize_and_test_predicates(ccx, predicates.into_vec()) { + if !normalize_and_test_predicates(tcx, predicates.into_vec()) { debug!("get_vtable_methods: predicates do not hold"); return None; }