diff options
| author | bors <bors@rust-lang.org> | 2019-09-19 06:53:54 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2019-09-19 06:53:54 +0000 |
| commit | 9b9d2aff8de4d499b4ba7ca406e000f8d3754ea7 (patch) | |
| tree | f38784726c530c78eb38684343435d85db7d2b1f /src/librustc/traits | |
| parent | 19d070393c05da7dfa1948f17872e55603a8c359 (diff) | |
| parent | 3b85597d22dc9dc9226445a95e275b8130880e63 (diff) | |
| download | rust-9b9d2aff8de4d499b4ba7ca406e000f8d3754ea7.tar.gz rust-9b9d2aff8de4d499b4ba7ca406e000f8d3754ea7.zip | |
Auto merge of #64545 - nnethercote:ObligForest-more, r=nmatsakis
More `ObligationForest` improvements Following on from #64500, these commits alsomake the code both nicer and faster. r? @nikomatsakis
Diffstat (limited to 'src/librustc/traits')
| -rw-r--r-- | src/librustc/traits/fulfill.rs | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/src/librustc/traits/fulfill.rs b/src/librustc/traits/fulfill.rs index 4494c034d51..805727b6ce0 100644 --- a/src/librustc/traits/fulfill.rs +++ b/src/librustc/traits/fulfill.rs @@ -256,15 +256,20 @@ impl<'a, 'b, 'tcx> ObligationProcessor for FulfillProcessor<'a, 'b, 'tcx> { &mut self, pending_obligation: &mut Self::Obligation, ) -> ProcessResult<Self::Obligation, Self::Error> { - // if we were stalled on some unresolved variables, first check + // If we were stalled on some unresolved variables, first check // whether any of them have been resolved; if not, don't bother // doing more work yet if !pending_obligation.stalled_on.is_empty() { - if pending_obligation.stalled_on.iter().all(|&ty| { - // Use the force-inlined variant of shallow_resolve() because this code is hot. - let resolved = ShallowResolver::new(self.selcx.infcx()).inlined_shallow_resolve(ty); - resolved == ty // nothing changed here - }) { + let mut changed = false; + // This `for` loop was once a call to `all()`, but this lower-level + // form was a perf win. See #64545 for details. + for &ty in &pending_obligation.stalled_on { + if ShallowResolver::new(self.selcx.infcx()).shallow_resolve_changed(ty) { + changed = true; + break; + } + } + if !changed { debug!("process_predicate: pending obligation {:?} still stalled on {:?}", self.selcx.infcx() .resolve_vars_if_possible(&pending_obligation.obligation), |
