about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMarkus Westerlind <markus.westerlind@distilnetworks.com>2020-05-07 23:27:21 +0200
committerMarkus Westerlind <markus.westerlind@distilnetworks.com>2020-05-07 23:31:10 +0200
commit1d8489c150df7d0e751f7c438541036df1a9ac5e (patch)
tree34f7ade4a5614914f42736c622cd0472119b4aad
parent97f3eeec8216d7155c24674b9be55e7c672bcae3 (diff)
downloadrust-1d8489c150df7d0e751f7c438541036df1a9ac5e.tar.gz
rust-1d8489c150df7d0e751f7c438541036df1a9ac5e.zip
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)
-rw-r--r--src/librustc_trait_selection/traits/fulfill.rs18
1 files 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<PredicateObligation<'tcx>>,
-) -> Vec<PendingPredicateObligation<'tcx>> {
+fn mk_pending(os: Vec<PredicateObligation<'tcx>>) -> Vec<PendingPredicateObligation<'tcx>> {
     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,