Skip to content

Commit 1d9472b

Browse files
committed
Update nll tests
1 parent 731ea85 commit 1d9472b

File tree

4 files changed

+29
-8
lines changed

4 files changed

+29
-8
lines changed
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
error: lifetime may not live long enough
2+
--> $DIR/issue-16922.rs:4:5
3+
|
4+
LL | fn foo<T: Any>(value: &T) -> Box<dyn Any> {
5+
| - let's call the lifetime of this reference `'1`
6+
LL | Box::new(value) as Box<dyn Any>
7+
| ^^^^^^^^^^^^^^^ cast requires that `'1` must outlive `'static`
8+
9+
error: aborting due to previous error
10+

src/test/ui/object-lifetime/object-lifetime-default-from-box-error.nll.stderr

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
error[E0621]: explicit lifetime required in the type of `ss`
1+
error: lifetime may not live long enough
22
--> $DIR/object-lifetime-default-from-box-error.rs:18:5
33
|
44
LL | fn load(ss: &mut SomeStruct) -> Box<dyn SomeTrait> {
5-
| --------------- help: add explicit lifetime `'static` to the type of `ss`: `&mut SomeStruct<'static>`
5+
| -- has type `&mut SomeStruct<'1>`
66
...
77
LL | ss.r
8-
| ^^^^ lifetime `'static` required
8+
| ^^^^ returning this value requires that `'1` must outlive `'static`
99

1010
error[E0507]: cannot move out of `ss.r` which is behind a mutable reference
1111
--> $DIR/object-lifetime-default-from-box-error.rs:18:5

src/test/ui/regions/region-object-lifetime-in-coercion.nll.stderr

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,17 @@ LL | fn b(v: &[u8]) -> Box<dyn Foo + 'static> {
1414
LL | Box::new(v)
1515
| ^^^^^^^^^^^ lifetime `'static` required
1616

17-
error[E0621]: explicit lifetime required in the type of `v`
18-
--> $DIR/region-object-lifetime-in-coercion.rs:21:5
17+
error: lifetime may not live long enough
18+
--> $DIR/region-object-lifetime-in-coercion.rs:20:5
1919
|
2020
LL | fn c(v: &[u8]) -> Box<dyn Foo> {
21-
| ----- help: add explicit lifetime `'static` to the type of `v`: `&'static [u8]`
21+
| - let's call the lifetime of this reference `'1`
2222
...
2323
LL | Box::new(v)
24-
| ^^^^^^^^^^^ lifetime `'static` required
24+
| ^^^^^^^^^^^ returning this value requires that `'1` must outlive `'static`
2525

2626
error: lifetime may not live long enough
27-
--> $DIR/region-object-lifetime-in-coercion.rs:26:5
27+
--> $DIR/region-object-lifetime-in-coercion.rs:24:5
2828
|
2929
LL | fn d<'a,'b>(v: &'a [u8]) -> Box<dyn Foo+'b> {
3030
| -- -- lifetime `'b` defined here
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
error: lifetime may not live long enough
2+
--> $DIR/dyn-trait-underscore.rs:8:5
3+
|
4+
LL | fn a<T>(items: &[T]) -> Box<dyn Iterator<Item=&T>> {
5+
| - let's call the lifetime of this reference `'1`
6+
LL | // ^^^^^^^^^^^^^^^^^^^^^ bound *here* defaults to `'static`
7+
LL | Box::new(items.iter())
8+
| ^^^^^^^^^^^^^^^^^^^^^^ returning this value requires that `'1` must outlive `'static`
9+
10+
error: aborting due to previous error
11+

0 commit comments

Comments
 (0)