Skip to content

Commit

Permalink
perf: Revert accidental inclusion of a part of #69218
Browse files Browse the repository at this point in the history
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)
  • Loading branch information
Markus Westerlind committed May 7, 2020
1 parent 97f3eee commit 1d8489c
Showing 1 changed file with 6 additions and 12 deletions.
18 changes: 6 additions & 12 deletions src/librustc_trait_selection/traits/fulfill.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}

Expand Down Expand Up @@ -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!(
Expand Down Expand Up @@ -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)),
}
}
Expand Down Expand Up @@ -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)),
}
}

Expand All @@ -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,
Expand Down

0 comments on commit 1d8489c

Please sign in to comment.