perf: Revert accidental inclusion of a part of #69218

This was accidentally included in #69494 after a rebase and given
how much `inflate` and `keccak` stresses the obligation forest seems
like a likely culprit to the regression in those benchmarks.

(It is necessary in #69218 as obligation forest needs to accurately
track the root variables or unifications will get lost)
This commit is contained in:
Markus Westerlind 2020-05-07 23:27:21 +02:00
parent 97f3eeec82
commit 1d8489c150

View File

@ -240,15 +240,9 @@ struct FulfillProcessor<'a, 'b, 'tcx> {
register_region_obligations: bool, register_region_obligations: bool,
} }
fn mk_pending( fn mk_pending(os: Vec<PredicateObligation<'tcx>>) -> Vec<PendingPredicateObligation<'tcx>> {
infcx: &InferCtxt<'_, 'tcx>,
os: Vec<PredicateObligation<'tcx>>,
) -> Vec<PendingPredicateObligation<'tcx>> {
os.into_iter() os.into_iter()
.map(|mut o| { .map(|o| PendingPredicateObligation { obligation: o, stalled_on: vec![] })
o.predicate = infcx.resolve_vars_if_possible(&o.predicate);
PendingPredicateObligation { obligation: o, stalled_on: vec![] }
})
.collect() .collect()
} }
@ -342,7 +336,7 @@ impl<'a, 'b, 'tcx> ObligationProcessor for FulfillProcessor<'a, 'b, 'tcx> {
"selecting trait `{:?}` at depth {} yielded Ok(Some)", "selecting trait `{:?}` at depth {} yielded Ok(Some)",
data, obligation.recursion_depth data, obligation.recursion_depth
); );
ProcessResult::Changed(mk_pending(infcx, vtable.nested_obligations())) ProcessResult::Changed(mk_pending(vtable.nested_obligations()))
} }
Ok(None) => { Ok(None) => {
debug!( debug!(
@ -436,7 +430,7 @@ impl<'a, 'b, 'tcx> ObligationProcessor for FulfillProcessor<'a, 'b, 'tcx> {
trait_ref_type_vars(self.selcx, data.to_poly_trait_ref(tcx)); trait_ref_type_vars(self.selcx, data.to_poly_trait_ref(tcx));
ProcessResult::Unchanged ProcessResult::Unchanged
} }
Ok(Some(os)) => ProcessResult::Changed(mk_pending(infcx, os)), Ok(Some(os)) => ProcessResult::Changed(mk_pending(os)),
Err(e) => ProcessResult::Error(CodeProjectionError(e)), Err(e) => ProcessResult::Error(CodeProjectionError(e)),
} }
} }
@ -475,7 +469,7 @@ impl<'a, 'b, 'tcx> ObligationProcessor for FulfillProcessor<'a, 'b, 'tcx> {
vec![TyOrConstInferVar::maybe_from_ty(ty).unwrap()]; vec![TyOrConstInferVar::maybe_from_ty(ty).unwrap()];
ProcessResult::Unchanged ProcessResult::Unchanged
} }
Some(os) => ProcessResult::Changed(mk_pending(infcx, os)), Some(os) => ProcessResult::Changed(mk_pending(os)),
} }
} }
@ -493,7 +487,7 @@ impl<'a, 'b, 'tcx> ObligationProcessor for FulfillProcessor<'a, 'b, 'tcx> {
]; ];
ProcessResult::Unchanged ProcessResult::Unchanged
} }
Some(Ok(ok)) => ProcessResult::Changed(mk_pending(infcx, ok.obligations)), Some(Ok(ok)) => ProcessResult::Changed(mk_pending(ok.obligations)),
Some(Err(err)) => { Some(Err(err)) => {
let expected_found = ExpectedFound::new( let expected_found = ExpectedFound::new(
subtype.skip_binder().a_is_expected, subtype.skip_binder().a_is_expected,