From 1d8489c150df7d0e751f7c438541036df1a9ac5e Mon Sep 17 00:00:00 2001 From: Markus Westerlind Date: Thu, 7 May 2020 23:27:21 +0200 Subject: [PATCH] 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) --- src/librustc_trait_selection/traits/fulfill.rs | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/src/librustc_trait_selection/traits/fulfill.rs b/src/librustc_trait_selection/traits/fulfill.rs index 1e056c96acd..bff1fa33129 100644 --- a/src/librustc_trait_selection/traits/fulfill.rs +++ b/src/librustc_trait_selection/traits/fulfill.rs @@ -240,15 +240,9 @@ struct FulfillProcessor<'a, 'b, 'tcx> { register_region_obligations: bool, } -fn mk_pending( - infcx: &InferCtxt<'_, 'tcx>, - os: Vec>, -) -> Vec> { +fn mk_pending(os: Vec>) -> Vec> { os.into_iter() - .map(|mut o| { - o.predicate = infcx.resolve_vars_if_possible(&o.predicate); - PendingPredicateObligation { obligation: o, stalled_on: vec![] } - }) + .map(|o| PendingPredicateObligation { obligation: o, stalled_on: vec![] }) .collect() } @@ -342,7 +336,7 @@ impl<'a, 'b, 'tcx> ObligationProcessor for FulfillProcessor<'a, 'b, 'tcx> { "selecting trait `{:?}` at depth {} yielded Ok(Some)", data, obligation.recursion_depth ); - ProcessResult::Changed(mk_pending(infcx, vtable.nested_obligations())) + ProcessResult::Changed(mk_pending(vtable.nested_obligations())) } Ok(None) => { 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)); 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)), } } @@ -475,7 +469,7 @@ impl<'a, 'b, 'tcx> ObligationProcessor for FulfillProcessor<'a, 'b, 'tcx> { vec![TyOrConstInferVar::maybe_from_ty(ty).unwrap()]; 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 } - Some(Ok(ok)) => ProcessResult::Changed(mk_pending(infcx, ok.obligations)), + Some(Ok(ok)) => ProcessResult::Changed(mk_pending(ok.obligations)), Some(Err(err)) => { let expected_found = ExpectedFound::new( subtype.skip_binder().a_is_expected,