about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorNiko Matsakis <niko@alum.mit.edu>2019-06-10 17:17:56 -0400
committerNiko Matsakis <niko@alum.mit.edu>2019-07-02 12:15:20 -0400
commitcc581bfa0e448f23060a2a6987a19f59461e0534 (patch)
treeb533355c3441f20707c278a5f231840ebab34fe0 /src
parentec48b4ebe24c24d9d43a3dbf57c28c249343d776 (diff)
remove old error and add an explanation
Diffstat (limited to 'src')
-rw-r--r--src/test/ui/impl-trait/needs_least_region_or_bound.rs14
-rw-r--r--src/test/ui/impl-trait/needs_least_region_or_bound.stderr48
2 files changed, 13 insertions, 49 deletions
diff --git a/src/test/ui/impl-trait/needs_least_region_or_bound.rs b/src/test/ui/impl-trait/needs_least_region_or_bound.rs
index 2a5b365559e..8475122cfae 100644
--- a/src/test/ui/impl-trait/needs_least_region_or_bound.rs
+++ b/src/test/ui/impl-trait/needs_least_region_or_bound.rs
@@ -1,10 +1,22 @@
+// run-pass
+
 use std::fmt::Debug;
 
 trait MultiRegionTrait<'a, 'b> {}
 impl<'a, 'b> MultiRegionTrait<'a, 'b> for (&'a u32, &'b u32) {}
 
 fn no_least_region<'a, 'b>(x: &'a u32, y: &'b u32) -> impl MultiRegionTrait<'a, 'b> {
-//~^ ERROR ambiguous lifetime bound
+    // Here we have a constraint that:
+    //
+    // (x, y) has type (&'0 u32, &'1 u32)
+    //
+    // where
+    //
+    // 'a: '0
+    //
+    // then we require that `('0 u32, &'1 u32): MultiRegionTrait<'a,
+    // 'b>`, which winds up imposing a requirement that `'0 = 'a` and
+    // `'1 = 'b`.
     (x, y)
 }
 
diff --git a/src/test/ui/impl-trait/needs_least_region_or_bound.stderr b/src/test/ui/impl-trait/needs_least_region_or_bound.stderr
deleted file mode 100644
index 9b9196a213d..00000000000
--- a/src/test/ui/impl-trait/needs_least_region_or_bound.stderr
+++ /dev/null
@@ -1,48 +0,0 @@
-error: impl Trait captures unexpected lifetime
-  --> $DIR/needs_least_region_or_bound.rs:6:55
-   |
-LL | fn no_least_region<'a, 'b>(x: &'a u32, y: &'b u32) -> impl MultiRegionTrait<'a, 'b> {
-   |                                                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ only lifetimes that appear in the impl Trait bounds may be captured
-   |
-note: hidden type captures the lifetime 'a as defined on the function body at 6:20
-  --> $DIR/needs_least_region_or_bound.rs:6:20
-   |
-LL | fn no_least_region<'a, 'b>(x: &'a u32, y: &'b u32) -> impl MultiRegionTrait<'a, 'b> {
-   |                    ^^
-note: hidden type would be allowed to capture the lifetime 'a as defined on the function body at 6:20
-  --> $DIR/needs_least_region_or_bound.rs:6:20
-   |
-LL | fn no_least_region<'a, 'b>(x: &'a u32, y: &'b u32) -> impl MultiRegionTrait<'a, 'b> {
-   |                    ^^
-note: hidden type would be allowed to capture the lifetime 'b as defined on the function body at 6:24
-  --> $DIR/needs_least_region_or_bound.rs:6:24
-   |
-LL | fn no_least_region<'a, 'b>(x: &'a u32, y: &'b u32) -> impl MultiRegionTrait<'a, 'b> {
-   |                        ^^
-   = note: hidden type would be allowed to capture the static lifetime
-
-error: impl Trait captures unexpected lifetime
-  --> $DIR/needs_least_region_or_bound.rs:6:55
-   |
-LL | fn no_least_region<'a, 'b>(x: &'a u32, y: &'b u32) -> impl MultiRegionTrait<'a, 'b> {
-   |                                                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ only lifetimes that appear in the impl Trait bounds may be captured
-   |
-note: hidden type captures the lifetime 'b as defined on the function body at 6:24
-  --> $DIR/needs_least_region_or_bound.rs:6:24
-   |
-LL | fn no_least_region<'a, 'b>(x: &'a u32, y: &'b u32) -> impl MultiRegionTrait<'a, 'b> {
-   |                        ^^
-note: hidden type would be allowed to capture the lifetime 'a as defined on the function body at 6:20
-  --> $DIR/needs_least_region_or_bound.rs:6:20
-   |
-LL | fn no_least_region<'a, 'b>(x: &'a u32, y: &'b u32) -> impl MultiRegionTrait<'a, 'b> {
-   |                    ^^
-note: hidden type would be allowed to capture the lifetime 'b as defined on the function body at 6:24
-  --> $DIR/needs_least_region_or_bound.rs:6:24
-   |
-LL | fn no_least_region<'a, 'b>(x: &'a u32, y: &'b u32) -> impl MultiRegionTrait<'a, 'b> {
-   |                        ^^
-   = note: hidden type would be allowed to capture the static lifetime
-
-error: aborting due to 2 previous errors
-