underscore-lifetime nll revisions
This commit is contained in:
parent
1c1d01eb49
commit
a2946ae299
@ -1,5 +1,5 @@
|
||||
error[E0759]: `items` has an anonymous lifetime `'_` but it needs to satisfy a `'static` lifetime requirement
|
||||
--> $DIR/dyn-trait-underscore.rs:8:20
|
||||
--> $DIR/dyn-trait-underscore.rs:12:20
|
||||
|
|
||||
LL | fn a<T>(items: &[T]) -> Box<dyn Iterator<Item=&T>> {
|
||||
| ---- this data with an anonymous lifetime `'_`...
|
||||
@ -10,7 +10,7 @@ LL | Box::new(items.iter())
|
||||
| ...is used and required to live as long as `'static` here
|
||||
|
|
||||
note: `'static` lifetime requirement introduced by the return type
|
||||
--> $DIR/dyn-trait-underscore.rs:6:29
|
||||
--> $DIR/dyn-trait-underscore.rs:10:29
|
||||
|
|
||||
LL | fn a<T>(items: &[T]) -> Box<dyn Iterator<Item=&T>> {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^ `'static` requirement introduced here
|
@ -1,5 +1,5 @@
|
||||
error: lifetime may not live long enough
|
||||
--> $DIR/dyn-trait-underscore.rs:8:5
|
||||
--> $DIR/dyn-trait-underscore.rs:12:5
|
||||
|
|
||||
LL | fn a<T>(items: &[T]) -> Box<dyn Iterator<Item=&T>> {
|
||||
| - let's call the lifetime of this reference `'1`
|
||||
|
@ -3,9 +3,15 @@
|
||||
//
|
||||
// cc #48468
|
||||
|
||||
// revisions: base nll
|
||||
// ignore-compare-mode-nll
|
||||
//[nll] compile-flags: -Z borrowck=mir
|
||||
|
||||
fn a<T>(items: &[T]) -> Box<dyn Iterator<Item=&T>> {
|
||||
// ^^^^^^^^^^^^^^^^^^^^^ bound *here* defaults to `'static`
|
||||
Box::new(items.iter()) //~ ERROR E0759
|
||||
Box::new(items.iter())
|
||||
//[base]~^ ERROR E0759
|
||||
//[nll]~^^ ERROR lifetime may not live long enough
|
||||
}
|
||||
|
||||
fn b<T>(items: &[T]) -> Box<dyn Iterator<Item=&T> + '_> {
|
||||
|
@ -1,5 +1,5 @@
|
||||
error[E0623]: lifetime mismatch
|
||||
--> $DIR/underscore-lifetime-elison-mismatch.rs:1:49
|
||||
--> $DIR/underscore-lifetime-elison-mismatch.rs:5:49
|
||||
|
|
||||
LL | fn foo(x: &mut Vec<&'_ u8>, y: &'_ u8) { x.push(y); }
|
||||
| ------ ------ ^ ...but data from `y` flows into `x` here
|
@ -1,5 +1,5 @@
|
||||
error: lifetime may not live long enough
|
||||
--> $DIR/underscore-lifetime-elison-mismatch.rs:1:42
|
||||
--> $DIR/underscore-lifetime-elison-mismatch.rs:5:42
|
||||
|
|
||||
LL | fn foo(x: &mut Vec<&'_ u8>, y: &'_ u8) { x.push(y); }
|
||||
| - - ^^^^^^^^^ argument requires that `'1` must outlive `'2`
|
||||
|
@ -1,3 +1,9 @@
|
||||
fn foo(x: &mut Vec<&'_ u8>, y: &'_ u8) { x.push(y); } //~ ERROR lifetime mismatch
|
||||
// revisions: base nll
|
||||
// ignore-compare-mode-nll
|
||||
//[nll] compile-flags: -Z borrowck=mir
|
||||
|
||||
fn foo(x: &mut Vec<&'_ u8>, y: &'_ u8) { x.push(y); }
|
||||
//[base]~^ ERROR lifetime mismatch
|
||||
//[nll]~^^ ERROR lifetime may not live long enough
|
||||
|
||||
fn main() {}
|
||||
|
Loading…
Reference in New Issue
Block a user