Update nll tests

This commit is contained in:
Esteban Küber 2020-05-26 17:22:47 -07:00
parent 731ea85f21
commit 1d9472b470
4 changed files with 29 additions and 8 deletions

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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