Skip to content

Commit f5805f6

Browse files
trans: Make normalize_and_test_predicates() not depend on CrateContext.
1 parent 51b4d6e commit f5805f6

File tree

3 files changed

+5
-6
lines changed

3 files changed

+5
-6
lines changed

src/librustc_trans/collector.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1191,7 +1191,7 @@ fn create_trans_items_for_default_impls<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
11911191
assert!(mth.is_provided);
11921192

11931193
let predicates = mth.method.predicates.predicates.subst(tcx, &mth.substs);
1194-
if !normalize_and_test_predicates(ccx, predicates.into_vec()) {
1194+
if !normalize_and_test_predicates(ccx.tcx(), predicates.into_vec()) {
11951195
continue;
11961196
}
11971197

src/librustc_trans/common.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1129,14 +1129,13 @@ pub fn fulfill_obligation<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
11291129
/// returns false, then either normalize encountered an error or one
11301130
/// of the predicates did not hold. Used when creating vtables to
11311131
/// check for unsatisfiable methods.
1132-
pub fn normalize_and_test_predicates<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
1133-
predicates: Vec<ty::Predicate<'tcx>>)
1134-
-> bool
1132+
pub fn normalize_and_test_predicates<'tcx>(tcx: &TyCtxt<'tcx>,
1133+
predicates: Vec<ty::Predicate<'tcx>>)
1134+
-> bool
11351135
{
11361136
debug!("normalize_and_test_predicates(predicates={:?})",
11371137
predicates);
11381138

1139-
let tcx = ccx.tcx();
11401139
let infcx = infer::normalizing_infer_ctxt(tcx, &tcx.tables, ProjectionMode::Any);
11411140
let mut selcx = SelectionContext::new(&infcx);
11421141
let mut fulfill_cx = traits::FulfillmentContext::new();

src/librustc_trans/meth.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,7 @@ pub fn get_vtable_methods<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
287287
// try and trans it, in that case. Issue #23435.
288288
if mth.is_provided {
289289
let predicates = mth.method.predicates.predicates.subst(tcx, &mth.substs);
290-
if !normalize_and_test_predicates(ccx, predicates.into_vec()) {
290+
if !normalize_and_test_predicates(tcx, predicates.into_vec()) {
291291
debug!("get_vtable_methods: predicates do not hold");
292292
return None;
293293
}

0 commit comments

Comments
 (0)