Skip to content

Commit a2946ae

Browse files
committed
underscore-lifetime nll revisions
1 parent 1c1d01e commit a2946ae

6 files changed

+19
-7
lines changed

src/test/ui/underscore-lifetime/dyn-trait-underscore.stderr renamed to src/test/ui/underscore-lifetime/dyn-trait-underscore.base.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error[E0759]: `items` has an anonymous lifetime `'_` but it needs to satisfy a `'static` lifetime requirement
2-
--> $DIR/dyn-trait-underscore.rs:8:20
2+
--> $DIR/dyn-trait-underscore.rs:12:20
33
|
44
LL | fn a<T>(items: &[T]) -> Box<dyn Iterator<Item=&T>> {
55
| ---- this data with an anonymous lifetime `'_`...
@@ -10,7 +10,7 @@ LL | Box::new(items.iter())
1010
| ...is used and required to live as long as `'static` here
1111
|
1212
note: `'static` lifetime requirement introduced by the return type
13-
--> $DIR/dyn-trait-underscore.rs:6:29
13+
--> $DIR/dyn-trait-underscore.rs:10:29
1414
|
1515
LL | fn a<T>(items: &[T]) -> Box<dyn Iterator<Item=&T>> {
1616
| ^^^^^^^^^^^^^^^^^^^^^ `'static` requirement introduced here

src/test/ui/underscore-lifetime/dyn-trait-underscore.nll.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error: lifetime may not live long enough
2-
--> $DIR/dyn-trait-underscore.rs:8:5
2+
--> $DIR/dyn-trait-underscore.rs:12:5
33
|
44
LL | fn a<T>(items: &[T]) -> Box<dyn Iterator<Item=&T>> {
55
| - let's call the lifetime of this reference `'1`

src/test/ui/underscore-lifetime/dyn-trait-underscore.rs

+7-1
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,15 @@
33
//
44
// cc #48468
55

6+
// revisions: base nll
7+
// ignore-compare-mode-nll
8+
//[nll] compile-flags: -Z borrowck=mir
9+
610
fn a<T>(items: &[T]) -> Box<dyn Iterator<Item=&T>> {
711
// ^^^^^^^^^^^^^^^^^^^^^ bound *here* defaults to `'static`
8-
Box::new(items.iter()) //~ ERROR E0759
12+
Box::new(items.iter())
13+
//[base]~^ ERROR E0759
14+
//[nll]~^^ ERROR lifetime may not live long enough
915
}
1016

1117
fn b<T>(items: &[T]) -> Box<dyn Iterator<Item=&T> + '_> {

src/test/ui/underscore-lifetime/underscore-lifetime-elison-mismatch.stderr renamed to src/test/ui/underscore-lifetime/underscore-lifetime-elison-mismatch.base.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error[E0623]: lifetime mismatch
2-
--> $DIR/underscore-lifetime-elison-mismatch.rs:1:49
2+
--> $DIR/underscore-lifetime-elison-mismatch.rs:5:49
33
|
44
LL | fn foo(x: &mut Vec<&'_ u8>, y: &'_ u8) { x.push(y); }
55
| ------ ------ ^ ...but data from `y` flows into `x` here

src/test/ui/underscore-lifetime/underscore-lifetime-elison-mismatch.nll.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error: lifetime may not live long enough
2-
--> $DIR/underscore-lifetime-elison-mismatch.rs:1:42
2+
--> $DIR/underscore-lifetime-elison-mismatch.rs:5:42
33
|
44
LL | fn foo(x: &mut Vec<&'_ u8>, y: &'_ u8) { x.push(y); }
55
| - - ^^^^^^^^^ argument requires that `'1` must outlive `'2`
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1-
fn foo(x: &mut Vec<&'_ u8>, y: &'_ u8) { x.push(y); } //~ ERROR lifetime mismatch
1+
// revisions: base nll
2+
// ignore-compare-mode-nll
3+
//[nll] compile-flags: -Z borrowck=mir
4+
5+
fn foo(x: &mut Vec<&'_ u8>, y: &'_ u8) { x.push(y); }
6+
//[base]~^ ERROR lifetime mismatch
7+
//[nll]~^^ ERROR lifetime may not live long enough
28

39
fn main() {}

0 commit comments

Comments
 (0)