about summary refs log tree commit diff
diff options
context:
space:
mode:
authorEsteban Küber <esteban@kuber.com.ar>2020-05-26 17:22:47 -0700
committerEsteban Küber <esteban@kuber.com.ar>2020-05-30 10:22:26 -0700
commit1d9472b4700ed64a42cf8000d182152255bce1ef (patch)
treed017ce6d58588beaf7c5516014ea414092b6eb3e
parent731ea85f215f03fc33a92147d6cc51a01dee589f (diff)
downloadrust-1d9472b4700ed64a42cf8000d182152255bce1ef.tar.gz
rust-1d9472b4700ed64a42cf8000d182152255bce1ef.zip
Update nll tests
-rw-r--r--src/test/ui/issues/issue-16922.nll.stderr10
-rw-r--r--src/test/ui/object-lifetime/object-lifetime-default-from-box-error.nll.stderr6
-rw-r--r--src/test/ui/regions/region-object-lifetime-in-coercion.nll.stderr10
-rw-r--r--src/test/ui/underscore-lifetime/dyn-trait-underscore.nll.stderr11
4 files changed, 29 insertions, 8 deletions
diff --git a/src/test/ui/issues/issue-16922.nll.stderr b/src/test/ui/issues/issue-16922.nll.stderr
new file mode 100644
index 00000000000..7f4f5b22eb3
--- /dev/null
+++ b/src/test/ui/issues/issue-16922.nll.stderr
@@ -0,0 +1,10 @@
+error: lifetime may not live long enough
+  --> $DIR/issue-16922.rs:4:5
+   |
+LL | fn foo<T: Any>(value: &T) -> Box<dyn Any> {
+   |                       - let's call the lifetime of this reference `'1`
+LL |     Box::new(value) as Box<dyn Any>
+   |     ^^^^^^^^^^^^^^^ cast requires that `'1` must outlive `'static`
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/object-lifetime/object-lifetime-default-from-box-error.nll.stderr b/src/test/ui/object-lifetime/object-lifetime-default-from-box-error.nll.stderr
index f6252f4ed79..9563c0dff36 100644
--- a/src/test/ui/object-lifetime/object-lifetime-default-from-box-error.nll.stderr
+++ b/src/test/ui/object-lifetime/object-lifetime-default-from-box-error.nll.stderr
@@ -1,11 +1,11 @@
-error[E0621]: explicit lifetime required in the type of `ss`
+error: lifetime may not live long enough
   --> $DIR/object-lifetime-default-from-box-error.rs:18:5
    |
 LL | fn load(ss: &mut SomeStruct) -> Box<dyn SomeTrait> {
-   |             --------------- help: add explicit lifetime `'static` to the type of `ss`: `&mut SomeStruct<'static>`
+   |         -- has type `&mut SomeStruct<'1>`
 ...
 LL |     ss.r
-   |     ^^^^ lifetime `'static` required
+   |     ^^^^ returning this value requires that `'1` must outlive `'static`
 
 error[E0507]: cannot move out of `ss.r` which is behind a mutable reference
   --> $DIR/object-lifetime-default-from-box-error.rs:18:5
diff --git a/src/test/ui/regions/region-object-lifetime-in-coercion.nll.stderr b/src/test/ui/regions/region-object-lifetime-in-coercion.nll.stderr
index 767853d8148..bf02ba8eb91 100644
--- a/src/test/ui/regions/region-object-lifetime-in-coercion.nll.stderr
+++ b/src/test/ui/regions/region-object-lifetime-in-coercion.nll.stderr
@@ -14,17 +14,17 @@ LL | fn b(v: &[u8]) -> Box<dyn Foo + 'static> {
 LL |     Box::new(v)
    |     ^^^^^^^^^^^ lifetime `'static` required
 
-error[E0621]: explicit lifetime required in the type of `v`
-  --> $DIR/region-object-lifetime-in-coercion.rs:21:5
+error: lifetime may not live long enough
+  --> $DIR/region-object-lifetime-in-coercion.rs:20:5
    |
 LL | fn c(v: &[u8]) -> Box<dyn Foo> {
-   |         ----- help: add explicit lifetime `'static` to the type of `v`: `&'static [u8]`
+   |         - let's call the lifetime of this reference `'1`
 ...
 LL |     Box::new(v)
-   |     ^^^^^^^^^^^ lifetime `'static` required
+   |     ^^^^^^^^^^^ returning this value requires that `'1` must outlive `'static`
 
 error: lifetime may not live long enough
-  --> $DIR/region-object-lifetime-in-coercion.rs:26:5
+  --> $DIR/region-object-lifetime-in-coercion.rs:24:5
    |
 LL | fn d<'a,'b>(v: &'a [u8]) -> Box<dyn Foo+'b> {
    |      -- -- lifetime `'b` defined here
diff --git a/src/test/ui/underscore-lifetime/dyn-trait-underscore.nll.stderr b/src/test/ui/underscore-lifetime/dyn-trait-underscore.nll.stderr
new file mode 100644
index 00000000000..8ed48bda26e
--- /dev/null
+++ b/src/test/ui/underscore-lifetime/dyn-trait-underscore.nll.stderr
@@ -0,0 +1,11 @@
+error: lifetime may not live long enough
+  --> $DIR/dyn-trait-underscore.rs:8:5
+   |
+LL | fn a<T>(items: &[T]) -> Box<dyn Iterator<Item=&T>> {
+   |                - let's call the lifetime of this reference `'1`
+LL |     //                      ^^^^^^^^^^^^^^^^^^^^^ bound *here* defaults to `'static`
+LL |     Box::new(items.iter())
+   |     ^^^^^^^^^^^^^^^^^^^^^^ returning this value requires that `'1` must outlive `'static`
+
+error: aborting due to previous error
+