about summary refs log tree commit diff
path: root/src/librustc/traits
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2019-04-25 20:27:16 +0000
committerbors <bors@rust-lang.org>2019-04-25 20:27:16 +0000
commit3991285f55a4b7cd92b7ffcdc396a3023076f5cb (patch)
tree6c7ceda57c17e2345c31bc28052d2348ddc2d14e /src/librustc/traits
parentc32171bd5efedd58fd471c21802e23005c2918fc (diff)
parent66e41bc675e9e7c8fc649bc088b1d48857610fb2 (diff)
downloadrust-3991285f55a4b7cd92b7ffcdc396a3023076f5cb.tar.gz
rust-3991285f55a4b7cd92b7ffcdc396a3023076f5cb.zip
Auto merge of #59111 - gilescope:generator-better-errors, r=nikomatsakis
Improved error message when type must be bound due to generator.

Fixes #58930.

Keen to get some feedback - is this as minimal as we can get it or is there an existing visitor I could repurpose?
Diffstat (limited to 'src/librustc/traits')
-rw-r--r--src/librustc/traits/project.rs6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/librustc/traits/project.rs b/src/librustc/traits/project.rs
index 360e2323b64..882635e21f5 100644
--- a/src/librustc/traits/project.rs
+++ b/src/librustc/traits/project.rs
@@ -594,7 +594,7 @@ fn opt_normalize_projection_type<'a, 'b, 'gcx, 'tcx>(
 
             // Once we have inferred everything we need to know, we
             // can ignore the `obligations` from that point on.
-            if !infcx.any_unresolved_type_vars(&ty.value) {
+            if infcx.unresolved_type_vars(&ty.value).is_none() {
                 infcx.projection_cache.borrow_mut().complete_normalized(cache_key, &ty);
                 // No need to extend `obligations`.
             } else {
@@ -704,7 +704,7 @@ fn opt_normalize_projection_type<'a, 'b, 'gcx, 'tcx>(
 fn prune_cache_value_obligations<'a, 'gcx, 'tcx>(infcx: &'a InferCtxt<'a, 'gcx, 'tcx>,
                                                  result: &NormalizedTy<'tcx>)
                                                  -> NormalizedTy<'tcx> {
-    if !infcx.any_unresolved_type_vars(&result.value) {
+    if infcx.unresolved_type_vars(&result.value).is_none() {
         return NormalizedTy { value: result.value, obligations: vec![] };
     }
 
@@ -722,7 +722,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.unresolved_type_vars(&data.ty()).is_some(),
 
                   // We are only interested in `T: Foo<X = U>` predicates, whre
                   // `U` references one of `unresolved_type_vars`. =)