about summary refs log tree commit diff
diff options
context:
space:
mode:
authorAriel Ben-Yehuda <ariel.byd@gmail.com>2017-10-06 17:12:24 +0300
committerNiko Matsakis <niko@alum.mit.edu>2017-10-06 10:39:57 -0400
commit7b54e83ff2fab5b0464dd0421b6d16d0a7a2ccce (patch)
treef232e200454120b28ca4de78556c934beaed689e
parent41d7051ee9d31146526f3920912be54e8e1dba4c (diff)
downloadrust-7b54e83ff2fab5b0464dd0421b6d16d0a7a2ccce.tar.gz
rust-7b54e83ff2fab5b0464dd0421b6d16d0a7a2ccce.zip
fix logic error in #44269's `prune_cache_value_obligations`
We want to retain obligations that *contain* inference variables, not
obligations that *don't contain* them, in order to fix #43132. Because
of surrounding changes to inference, the ICE doesn't occur in its
original case, but I believe it could still be made to occur on master.

Maybe I should try to write a new test case? Certainly not right now
(I'm mainly trying to get us a beta that we can ship) but maybe before
we land this PR on nightly?

This seems to cause a 10% performance regression in my imprecise
attempt to benchmark item-body checking for #43613, but it's better to
be slow and right than fast and wrong. If we want to recover that, I
think we can change the constrained-type-parameter code to actually
give a list of projections that are important for resolving inference
variables and filter everything else out.
-rw-r--r--src/librustc/traits/project.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/librustc/traits/project.rs b/src/librustc/traits/project.rs
index bd511f1acb1..f5055b9765e 100644
--- a/src/librustc/traits/project.rs
+++ b/src/librustc/traits/project.rs
@@ -604,7 +604,7 @@ fn prune_cache_value_obligations<'a, 'gcx, 'tcx>(infcx: &'a InferCtxt<'a, 'gcx,
                   // but we have `T: Foo<X = ?1>` and `?1: Bar<X =
                   // ?0>`).
                   ty::Predicate::Projection(ref data) =>
-                      !infcx.any_unresolved_type_vars(&data.ty()),
+                      infcx.any_unresolved_type_vars(&data.ty()),
 
                   // We are only interested in `T: Foo<X = U>` predicates, whre
                   // `U` references one of `unresolved_type_vars`. =)