Use revisions for NLL in issues

This commit is contained in:
Jack Huey 2022-05-22 01:02:55 -04:00
parent b7c192e346
commit b391b329f0
48 changed files with 159 additions and 78 deletions

View File

@ -1,19 +1,21 @@
error[E0312]: lifetime of reference outlives lifetime of borrowed content...
--> $DIR/issue-10291.rs:3:9
--> $DIR/issue-10291.rs:7:9
|
LL | x
| ^
|
note: ...the reference is valid for the anonymous lifetime #1 defined here...
--> $DIR/issue-10291.rs:2:69
--> $DIR/issue-10291.rs:6:69
|
LL | drop::<Box<dyn for<'z> FnMut(&'z isize) -> &'z isize>>(Box::new(|z| {
| _____________________________________________________________________^
LL | | x
LL | |
LL | |
LL | | }));
| |_____^
note: ...but the borrowed content is only valid for the lifetime `'x` as defined here
--> $DIR/issue-10291.rs:1:9
--> $DIR/issue-10291.rs:5:9
|
LL | fn test<'x>(x: &'x isize) {
| ^^

View File

@ -1,5 +1,5 @@
error: lifetime may not live long enough
--> $DIR/issue-10291.rs:3:9
--> $DIR/issue-10291.rs:7:9
|
LL | fn test<'x>(x: &'x isize) {
| -- lifetime `'x` defined here

View File

@ -1,6 +1,12 @@
// revisions: base nll
// ignore-compare-mode-nll
//[nll] compile-flags: -Z borrowck=mir
fn test<'x>(x: &'x isize) {
drop::<Box<dyn for<'z> FnMut(&'z isize) -> &'z isize>>(Box::new(|z| {
x //~ ERROR E0312
x
//[base]~^ ERROR E0312
//[nll]~^^ ERROR lifetime may not live long enough
}));
}

View File

@ -1,5 +1,5 @@
error[E0621]: explicit lifetime required in the type of `cont`
--> $DIR/issue-13058.rs:14:26
--> $DIR/issue-13058.rs:18:26
|
LL | fn check<'r, I: Iterator<Item=usize>, T: Itble<'r, usize, I>>(cont: &T) -> bool
| -- help: add explicit lifetime `'r` to the type of `cont`: `&'r T`

View File

@ -1,5 +1,5 @@
error[E0621]: explicit lifetime required in the type of `cont`
--> $DIR/issue-13058.rs:14:21
--> $DIR/issue-13058.rs:18:21
|
LL | fn check<'r, I: Iterator<Item=usize>, T: Itble<'r, usize, I>>(cont: &T) -> bool
| -- help: add explicit lifetime `'r` to the type of `cont`: `&'r T`

View File

@ -1,3 +1,7 @@
// revisions: base nll
// ignore-compare-mode-nll
//[nll] compile-flags: -Z borrowck=mir
use std::ops::Range;
trait Itble<'r, T, I: Iterator<Item=T>> { fn iter(&'r self) -> I; }

View File

@ -1,5 +1,5 @@
error[E0621]: explicit lifetime required in the type of `lexer`
--> $DIR/issue-15034.rs:17:25
--> $DIR/issue-15034.rs:21:25
|
LL | pub fn new(lexer: &'a mut Lexer) -> Parser<'a> {
| ------------- help: add explicit lifetime `'a` to the type of `lexer`: `&'a mut Lexer<'a>`

View File

@ -1,5 +1,5 @@
error[E0621]: explicit lifetime required in the type of `lexer`
--> $DIR/issue-15034.rs:17:9
--> $DIR/issue-15034.rs:21:9
|
LL | pub fn new(lexer: &'a mut Lexer) -> Parser<'a> {
| ------------- help: add explicit lifetime `'a` to the type of `lexer`: `&'a mut Lexer<'a>`

View File

@ -1,3 +1,7 @@
// revisions: base nll
// ignore-compare-mode-nll
//[nll] compile-flags: -Z borrowck=mir
pub struct Lexer<'a> {
input: &'a str,
}

View File

@ -1,26 +1,26 @@
error[E0495]: cannot infer an appropriate lifetime for autoref due to conflicting requirements
--> $DIR/issue-16683.rs:4:14
--> $DIR/issue-16683.rs:8:14
|
LL | self.a();
| ^
|
note: first, the lifetime cannot outlive the anonymous lifetime defined here...
--> $DIR/issue-16683.rs:3:10
--> $DIR/issue-16683.rs:7:10
|
LL | fn b(&self) {
| ^^^^^
note: ...so that reference does not outlive borrowed content
--> $DIR/issue-16683.rs:4:9
--> $DIR/issue-16683.rs:8:9
|
LL | self.a();
| ^^^^
note: but, the lifetime must be valid for the lifetime `'a` as defined here...
--> $DIR/issue-16683.rs:1:9
--> $DIR/issue-16683.rs:5:9
|
LL | trait T<'a> {
| ^^
note: ...so that the types are compatible
--> $DIR/issue-16683.rs:4:14
--> $DIR/issue-16683.rs:8:14
|
LL | self.a();
| ^

View File

@ -1,5 +1,5 @@
error: lifetime may not live long enough
--> $DIR/issue-16683.rs:4:9
--> $DIR/issue-16683.rs:8:9
|
LL | trait T<'a> {
| -- lifetime `'a` defined here

View File

@ -1,7 +1,13 @@
// revisions: base nll
// ignore-compare-mode-nll
//[nll] compile-flags: -Z borrowck=mir
trait T<'a> {
fn a(&'a self) -> &'a bool;
fn b(&self) {
self.a(); //~ ERROR cannot infer
self.a();
//[base]~^ ERROR cannot infer
//[nll]~^^ ERROR lifetime may not live long enough
}
}

View File

@ -1,5 +1,5 @@
error[E0759]: `value` has an anonymous lifetime `'_` but it needs to satisfy a `'static` lifetime requirement
--> $DIR/issue-16922.rs:4:14
--> $DIR/issue-16922.rs:8:14
|
LL | fn foo<T: Any>(value: &T) -> Box<dyn Any> {
| -- this data with an anonymous lifetime `'_`...

View File

@ -1,5 +1,5 @@
error: lifetime may not live long enough
--> $DIR/issue-16922.rs:4:5
--> $DIR/issue-16922.rs:8:5
|
LL | fn foo<T: Any>(value: &T) -> Box<dyn Any> {
| - let's call the lifetime of this reference `'1`

View File

@ -1,7 +1,13 @@
// revisions: base nll
// ignore-compare-mode-nll
//[nll] compile-flags: -Z borrowck=mir
use std::any::Any;
fn foo<T: Any>(value: &T) -> Box<dyn Any> {
Box::new(value) as Box<dyn Any> //~ ERROR E0759
Box::new(value) as Box<dyn Any>
//[base]~^ ERROR E0759
//[nll]~^^ ERROR lifetime may not live long enough
}
fn main() {

View File

@ -1,5 +1,5 @@
error[E0623]: lifetime mismatch
--> $DIR/issue-17728.rs:15:28
--> $DIR/issue-17728.rs:19:28
|
LL | fn attemptTraverse(&self, room: &Room, directionStr: &str) -> Result<&Room, &str> {
| ----- -------------------
@ -16,7 +16,7 @@ LL | fn attemptTraverse<'a>(&'a self, room: &'a Room, directionStr: &str) ->
| ++++ ++ ++
error[E0308]: `match` arms have incompatible types
--> $DIR/issue-17728.rs:109:14
--> $DIR/issue-17728.rs:113:14
|
LL | / match to_parse {
LL | | "w" | "west" => RoomDirection::West,

View File

@ -1,5 +1,5 @@
error[E0308]: `match` arms have incompatible types
--> $DIR/issue-17728.rs:109:14
--> $DIR/issue-17728.rs:113:14
|
LL | / match to_parse {
LL | | "w" | "west" => RoomDirection::West,

View File

@ -1,3 +1,7 @@
// revisions: base nll
// ignore-compare-mode-nll
//[nll] compile-flags: -Z borrowck=mir
use std::fmt::{Debug, Formatter, Error};
use std::collections::HashMap;
@ -13,7 +17,7 @@ fn attemptTraverse(&self, room: &Room, directionStr: &str) -> Result<&Room, &str
let maybe_room = room.direction_to_room.get(&direction);
match maybe_room {
Some(entry) => Ok(entry),
//~^ ERROR lifetime mismatch [E0623]
//[base]~^ ERROR lifetime mismatch [E0623]
_ => Err("Direction does not exist in room.")
}
}

View File

@ -1,26 +1,26 @@
error[E0495]: cannot infer an appropriate lifetime for autoref due to conflicting requirements
--> $DIR/issue-17758.rs:7:14
--> $DIR/issue-17758.rs:11:14
|
LL | self.foo();
| ^^^
|
note: first, the lifetime cannot outlive the anonymous lifetime defined here...
--> $DIR/issue-17758.rs:6:12
--> $DIR/issue-17758.rs:10:12
|
LL | fn bar(&self) {
| ^^^^^
note: ...so that reference does not outlive borrowed content
--> $DIR/issue-17758.rs:7:9
--> $DIR/issue-17758.rs:11:9
|
LL | self.foo();
| ^^^^
note: but, the lifetime must be valid for the lifetime `'a` as defined here...
--> $DIR/issue-17758.rs:4:11
--> $DIR/issue-17758.rs:8:11
|
LL | trait Foo<'a> {
| ^^
note: ...so that the types are compatible
--> $DIR/issue-17758.rs:7:14
--> $DIR/issue-17758.rs:11:14
|
LL | self.foo();
| ^^^

View File

@ -1,5 +1,5 @@
error: lifetime may not live long enough
--> $DIR/issue-17758.rs:7:9
--> $DIR/issue-17758.rs:11:9
|
LL | trait Foo<'a> {
| -- lifetime `'a` defined here

View File

@ -1,3 +1,7 @@
// revisions: base nll
// ignore-compare-mode-nll
//[nll] compile-flags: -Z borrowck=mir
// Test that regionck suggestions in a provided method of a trait
// don't ICE
@ -5,7 +9,8 @@ trait Foo<'a> {
fn foo(&'a self);
fn bar(&self) {
self.foo();
//~^ ERROR cannot infer
//[base]~^ ERROR cannot infer
//[nll]~^^ ERROR lifetime may not live long enough
}
}

View File

@ -1,5 +1,5 @@
error[E0477]: the type `&'a i32` does not fulfill the required lifetime
--> $DIR/issue-26217.rs:4:5
--> $DIR/issue-26217.rs:8:5
|
LL | foo::<&'a i32>();
| ^^^^^^^^^^^^^^

View File

@ -1,5 +1,5 @@
error: lifetime may not live long enough
--> $DIR/issue-26217.rs:4:5
--> $DIR/issue-26217.rs:8:5
|
LL | fn bar<'a>() {
| -- lifetime `'a` defined here

View File

@ -1,8 +1,13 @@
// revisions: base nll
// ignore-compare-mode-nll
//[nll] compile-flags: -Z borrowck=mir
fn foo<T>() where for<'a> T: 'a {}
fn bar<'a>() {
foo::<&'a i32>();
//~^ ERROR the type `&'a i32` does not fulfill the required lifetime
//[base]~^ ERROR the type `&'a i32` does not fulfill the required lifetime
//[nll]~^^ ERROR lifetime may not live long enough
}
fn main() {

View File

@ -1,5 +1,5 @@
error[E0308]: mismatched types
--> $DIR/issue-40000.rs:6:9
--> $DIR/issue-40000.rs:10:9
|
LL | foo(bar);
| ^^^ one type is more general than the other

View File

@ -1,5 +1,5 @@
error[E0308]: mismatched types
--> $DIR/issue-40000.rs:6:9
--> $DIR/issue-40000.rs:10:9
|
LL | foo(bar);
| ^^^ one type is more general than the other
@ -8,7 +8,7 @@ LL | foo(bar);
found trait object `dyn Fn(&i32)`
error[E0308]: mismatched types
--> $DIR/issue-40000.rs:6:9
--> $DIR/issue-40000.rs:10:9
|
LL | foo(bar);
| ^^^ one type is more general than the other

View File

@ -1,7 +1,13 @@
// revisions: base nll
// ignore-compare-mode-nll
//[nll] compile-flags: -Z borrowck=mir
fn main() {
let bar: fn(&mut u32) = |_| {};
fn foo(x: Box<dyn Fn(&i32)>) {}
let bar = Box::new(|x: &i32| {}) as Box<dyn Fn(_)>;
foo(bar); //~ ERROR E0308
foo(bar);
//~^ ERROR E0308
//[nll]~^^ ERROR mismatched types
}

View File

@ -1,5 +1,5 @@
error[E0759]: `x` has an anonymous lifetime `'_` but it needs to satisfy a `'static` lifetime requirement
--> $DIR/issue-46983.rs:2:5
--> $DIR/issue-46983.rs:6:5
|
LL | fn foo(x: &u32) -> &'static u32 {
| ---- this data with an anonymous lifetime `'_`...

View File

@ -1,5 +1,5 @@
error: lifetime may not live long enough
--> $DIR/issue-46983.rs:2:5
--> $DIR/issue-46983.rs:6:5
|
LL | fn foo(x: &u32) -> &'static u32 {
| - let's call the lifetime of this reference `'1`

View File

@ -1,6 +1,11 @@
// revisions: base nll
// ignore-compare-mode-nll
//[nll] compile-flags: -Z borrowck=mir
fn foo(x: &u32) -> &'static u32 {
&*x
//~^ ERROR `x` has an anonymous lifetime `'_` but it needs to satisfy a `'static` lifetime requirement [E0759]
//[base]~^ ERROR `x` has an anonymous lifetime `'_` but it needs to satisfy a `'static` lifetime requirement [E0759]
//[nll]~^^ ERROR lifetime may not live long enough
}
fn main() {}

View File

@ -1,16 +1,16 @@
error[E0312]: lifetime of reference outlives lifetime of borrowed content...
--> $DIR/issue-52533.rs:5:16
--> $DIR/issue-52533.rs:9:16
|
LL | foo(|a, b| b)
| ^
|
note: ...the reference is valid for the anonymous lifetime #1 defined here...
--> $DIR/issue-52533.rs:5:9
--> $DIR/issue-52533.rs:9:9
|
LL | foo(|a, b| b)
| ^^^^^^^^
note: ...but the borrowed content is only valid for the anonymous lifetime #2 defined here
--> $DIR/issue-52533.rs:5:9
--> $DIR/issue-52533.rs:9:9
|
LL | foo(|a, b| b)
| ^^^^^^^^

View File

@ -1,5 +1,5 @@
error: lifetime may not live long enough
--> $DIR/issue-52533.rs:5:16
--> $DIR/issue-52533.rs:9:16
|
LL | foo(|a, b| b)
| - - ^ closure was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1`

View File

@ -1,7 +1,12 @@
// revisions: base nll
// ignore-compare-mode-nll
//[nll] compile-flags: -Z borrowck=mir
fn foo(_: impl for<'a> FnOnce(&'a u32, &u32) -> &'a u32) {
}
fn main() {
foo(|a, b| b)
//~^ ERROR lifetime of reference outlives lifetime of borrowed content...
//[base]~^ ERROR lifetime of reference outlives lifetime of borrowed content...
//[nll]~^^ ERROR lifetime may not live long enough
}

View File

@ -1,5 +1,5 @@
error: implementation of `Foo` is not general enough
--> $DIR/issue-54302-cases.rs:63:5
--> $DIR/issue-54302-cases.rs:67:5
|
LL | <u32 as RefFoo<u32>>::ref_foo(a)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ implementation of `Foo` is not general enough
@ -8,7 +8,7 @@ LL | <u32 as RefFoo<u32>>::ref_foo(a)
= note: ...but `Foo<'_, u32>` is actually implemented for the type `&'1 u32`, for some specific lifetime `'1`
error: implementation of `Foo` is not general enough
--> $DIR/issue-54302-cases.rs:69:5
--> $DIR/issue-54302-cases.rs:73:5
|
LL | <i32 as RefFoo<i32>>::ref_foo(a)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ implementation of `Foo` is not general enough
@ -17,7 +17,7 @@ LL | <i32 as RefFoo<i32>>::ref_foo(a)
= note: ...but `Foo<'_, i32>` is actually implemented for the type `&'1 i32`, for some specific lifetime `'1`
error: implementation of `Foo` is not general enough
--> $DIR/issue-54302-cases.rs:75:5
--> $DIR/issue-54302-cases.rs:79:5
|
LL | <u64 as RefFoo<u64>>::ref_foo(a)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ implementation of `Foo` is not general enough
@ -26,7 +26,7 @@ LL | <u64 as RefFoo<u64>>::ref_foo(a)
= note: ...but `Foo<'_, u64>` is actually implemented for the type `&'1 u64`, for some specific lifetime `'1`
error: implementation of `Foo` is not general enough
--> $DIR/issue-54302-cases.rs:81:5
--> $DIR/issue-54302-cases.rs:85:5
|
LL | <i64 as RefFoo<i64>>::ref_foo(a)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ implementation of `Foo` is not general enough

View File

@ -1,5 +1,5 @@
error: implementation of `Foo` is not general enough
--> $DIR/issue-54302-cases.rs:63:5
--> $DIR/issue-54302-cases.rs:67:5
|
LL | <u32 as RefFoo<u32>>::ref_foo(a)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ implementation of `Foo` is not general enough
@ -8,7 +8,7 @@ LL | <u32 as RefFoo<u32>>::ref_foo(a)
= note: ...but `Foo<'_, u32>` is actually implemented for the type `&'1 u32`, for some specific lifetime `'1`
error: implementation of `Foo` is not general enough
--> $DIR/issue-54302-cases.rs:69:5
--> $DIR/issue-54302-cases.rs:73:5
|
LL | <i32 as RefFoo<i32>>::ref_foo(a)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ implementation of `Foo` is not general enough
@ -17,7 +17,7 @@ LL | <i32 as RefFoo<i32>>::ref_foo(a)
= note: ...but `Foo<'_, i32>` is actually implemented for the type `&'1 i32`, for some specific lifetime `'1`
error: implementation of `Foo` is not general enough
--> $DIR/issue-54302-cases.rs:75:5
--> $DIR/issue-54302-cases.rs:79:5
|
LL | <u64 as RefFoo<u64>>::ref_foo(a)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ implementation of `Foo` is not general enough
@ -26,7 +26,7 @@ LL | <u64 as RefFoo<u64>>::ref_foo(a)
= note: ...but `Foo<'_, u64>` is actually implemented for the type `&'1 u64`, for some specific lifetime `'1`
error: implementation of `Foo` is not general enough
--> $DIR/issue-54302-cases.rs:81:5
--> $DIR/issue-54302-cases.rs:85:5
|
LL | <i64 as RefFoo<i64>>::ref_foo(a)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ implementation of `Foo` is not general enough

View File

@ -1,3 +1,7 @@
// revisions: base nll
// ignore-compare-mode-nll
//[nll] compile-flags: -Z borrowck=mir
trait Mirror {
type Image;
fn coerce(self) -> Self::Image;

View File

@ -1,11 +1,11 @@
error[E0477]: the type `&'a u32` does not fulfill the required lifetime
--> $DIR/issue-54943.rs:6:13
--> $DIR/issue-54943.rs:10:13
|
LL | let x = foo::<&'a u32>();
| ^^^^^^^^^^^^^^
|
note: type must satisfy the static lifetime as required by this binding
--> $DIR/issue-54943.rs:1:11
--> $DIR/issue-54943.rs:5:11
|
LL | fn foo<T: 'static>() { }
| ^^^^^^^

View File

@ -1,5 +1,5 @@
error: lifetime may not live long enough
--> $DIR/issue-54943.rs:6:13
--> $DIR/issue-54943.rs:10:13
|
LL | fn boo<'a>() {
| -- lifetime `'a` defined here

View File

@ -1,3 +1,7 @@
// revisions: base nll
// ignore-compare-mode-nll
//[nll] compile-flags: -Z borrowck=mir
fn foo<T: 'static>() { }
fn boo<'a>() {

View File

@ -1,5 +1,5 @@
error: implementation of `DistributedIteratorMulti` is not general enough
--> $DIR/issue-55731.rs:48:5
--> $DIR/issue-55731.rs:52:5
|
LL | multi(Map {
| ^^^^^ implementation of `DistributedIteratorMulti` is not general enough

View File

@ -1,5 +1,5 @@
error: implementation of `DistributedIteratorMulti` is not general enough
--> $DIR/issue-55731.rs:48:5
--> $DIR/issue-55731.rs:52:5
|
LL | / multi(Map {
LL | | i: Cloned(PhantomData),

View File

@ -1,3 +1,7 @@
// revisions: base nll
// ignore-compare-mode-nll
//[nll] compile-flags: -Z borrowck=mir
use std::marker::PhantomData;
trait DistributedIterator {

View File

@ -1,22 +1,22 @@
error[E0495]: cannot infer an appropriate lifetime due to conflicting requirements
--> $DIR/issue-55796.rs:16:9
--> $DIR/issue-55796.rs:20:9
|
LL | Box::new(self.out_edges(u).map(|e| e.target()))
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
note: first, the lifetime cannot outlive the lifetime `'a` as defined here...
--> $DIR/issue-55796.rs:5:17
--> $DIR/issue-55796.rs:9:17
|
LL | pub trait Graph<'a> {
| ^^
note: ...so that the type `Map<<Self as Graph<'a>>::EdgesIter, [closure@$DIR/issue-55796.rs:16:40: 16:54]>` will meet its required lifetime bounds
--> $DIR/issue-55796.rs:16:9
note: ...so that the type `Map<<Self as Graph<'a>>::EdgesIter, [closure@$DIR/issue-55796.rs:20:40: 20:54]>` will meet its required lifetime bounds
--> $DIR/issue-55796.rs:20:9
|
LL | Box::new(self.out_edges(u).map(|e| e.target()))
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
= note: but, the lifetime must be valid for the static lifetime...
note: ...so that the types are compatible
--> $DIR/issue-55796.rs:16:9
--> $DIR/issue-55796.rs:20:9
|
LL | Box::new(self.out_edges(u).map(|e| e.target()))
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@ -24,24 +24,24 @@ LL | Box::new(self.out_edges(u).map(|e| e.target()))
found `Box<dyn Iterator<Item = <Self as Graph<'a>>::Node>>`
error[E0495]: cannot infer an appropriate lifetime due to conflicting requirements
--> $DIR/issue-55796.rs:21:9
--> $DIR/issue-55796.rs:26:9
|
LL | Box::new(self.in_edges(u).map(|e| e.target()))
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
note: first, the lifetime cannot outlive the lifetime `'a` as defined here...
--> $DIR/issue-55796.rs:5:17
--> $DIR/issue-55796.rs:9:17
|
LL | pub trait Graph<'a> {
| ^^
note: ...so that the type `Map<<Self as Graph<'a>>::EdgesIter, [closure@$DIR/issue-55796.rs:21:39: 21:53]>` will meet its required lifetime bounds
--> $DIR/issue-55796.rs:21:9
note: ...so that the type `Map<<Self as Graph<'a>>::EdgesIter, [closure@$DIR/issue-55796.rs:26:39: 26:53]>` will meet its required lifetime bounds
--> $DIR/issue-55796.rs:26:9
|
LL | Box::new(self.in_edges(u).map(|e| e.target()))
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
= note: but, the lifetime must be valid for the static lifetime...
note: ...so that the types are compatible
--> $DIR/issue-55796.rs:21:9
--> $DIR/issue-55796.rs:26:9
|
LL | Box::new(self.in_edges(u).map(|e| e.target()))
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

View File

@ -1,5 +1,5 @@
error: lifetime may not live long enough
--> $DIR/issue-55796.rs:16:9
--> $DIR/issue-55796.rs:20:9
|
LL | pub trait Graph<'a> {
| -- lifetime `'a` defined here
@ -8,7 +8,7 @@ LL | Box::new(self.out_edges(u).map(|e| e.target()))
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ returning this value requires that `'a` must outlive `'static`
error: lifetime may not live long enough
--> $DIR/issue-55796.rs:21:9
--> $DIR/issue-55796.rs:26:9
|
LL | pub trait Graph<'a> {
| -- lifetime `'a` defined here

View File

@ -1,3 +1,7 @@
// revisions: base nll
// ignore-compare-mode-nll
//[nll] compile-flags: -Z borrowck=mir
pub trait EdgeTrait<N> {
fn target(&self) -> N;
}
@ -14,12 +18,14 @@ pub trait Graph<'a> {
fn out_neighbors(&'a self, u: &Self::Node) -> Box<dyn Iterator<Item = Self::Node>> {
Box::new(self.out_edges(u).map(|e| e.target()))
//~^ ERROR cannot infer
//[base]~^ ERROR cannot infer
//[nll]~^^ ERROR lifetime may not live long enough
}
fn in_neighbors(&'a self, u: &Self::Node) -> Box<dyn Iterator<Item = Self::Node>> {
Box::new(self.in_edges(u).map(|e| e.target()))
//~^ ERROR cannot infer
//[base]~^ ERROR cannot infer
//[nll]~^^ ERROR lifetime may not live long enough
}
}

View File

@ -1,16 +1,16 @@
error[E0495]: cannot infer an appropriate lifetime due to conflicting requirements
--> $DIR/issue-75777.rs:11:14
--> $DIR/issue-75777.rs:15:14
|
LL | Box::new(move |_| fut)
| ^^^^^^^^^^^^
|
note: first, the lifetime cannot outlive the lifetime `'a` as defined here...
--> $DIR/issue-75777.rs:9:11
--> $DIR/issue-75777.rs:13:11
|
LL | fn inject<'a, Env: 'a, A: 'a + Send>(v: A) -> Box<dyn FnOnce(&'a Env) -> BoxFuture<'a, A>> {
| ^^
note: ...so that the types are compatible
--> $DIR/issue-75777.rs:11:14
--> $DIR/issue-75777.rs:15:14
|
LL | Box::new(move |_| fut)
| ^^^^^^^^^^^^
@ -18,7 +18,7 @@ LL | Box::new(move |_| fut)
found `(Pin<Box<(dyn Future<Output = A> + Send + 'a)>>,)`
= note: but, the lifetime must be valid for the static lifetime...
note: ...so that the types are compatible
--> $DIR/issue-75777.rs:11:5
--> $DIR/issue-75777.rs:15:5
|
LL | Box::new(move |_| fut)
| ^^^^^^^^^^^^^^^^^^^^^^

View File

@ -1,5 +1,5 @@
error: lifetime may not live long enough
--> $DIR/issue-75777.rs:11:5
--> $DIR/issue-75777.rs:15:5
|
LL | fn inject<'a, Env: 'a, A: 'a + Send>(v: A) -> Box<dyn FnOnce(&'a Env) -> BoxFuture<'a, A>> {
| -- lifetime `'a` defined here

View File

@ -1,3 +1,7 @@
// revisions: base nll
// ignore-compare-mode-nll
//[nll] compile-flags: -Z borrowck=mir
// Regression test for #75777.
// Checks that a boxed future can be properly constructed.
@ -9,7 +13,8 @@
fn inject<'a, Env: 'a, A: 'a + Send>(v: A) -> Box<dyn FnOnce(&'a Env) -> BoxFuture<'a, A>> {
let fut: BoxFuture<'a, A> = Box::pin(future::ready(v));
Box::new(move |_| fut)
//~^ ERROR: cannot infer an appropriate lifetime
//[base]~^ ERROR: cannot infer an appropriate lifetime
//[nll]~^^ ERROR: lifetime may not live long enough
}
fn main() {}