rust/tests/ui/nll/outlives-suggestion-simple.stderr

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

105 lines
3.8 KiB
Plaintext
Raw Normal View History

2018-11-28 15:05:36 -06:00
error: lifetime may not live long enough
2022-04-01 12:13:25 -05:00
--> $DIR/outlives-suggestion-simple.rs:4:5
2018-11-28 15:05:36 -06:00
|
LL | fn foo1<'a, 'b>(x: &'a usize) -> &'b usize {
| -- -- lifetime `'b` defined here
| |
| lifetime `'a` defined here
LL | x
| ^ function was supposed to return data with lifetime `'b` but it is returning data with lifetime `'a`
2018-11-28 15:05:36 -06:00
|
2019-10-27 09:39:14 -05:00
= help: consider adding the following bound: `'a: 'b`
2018-11-28 15:05:36 -06:00
error: lifetime may not live long enough
2022-04-01 12:13:25 -05:00
--> $DIR/outlives-suggestion-simple.rs:8:5
2018-11-28 15:05:36 -06:00
|
LL | fn foo2<'a>(x: &'a usize) -> &'static usize {
| -- lifetime `'a` defined here
LL | x
| ^ returning this value requires that `'a` must outlive `'static`
error: lifetime may not live long enough
2022-04-01 12:13:25 -05:00
--> $DIR/outlives-suggestion-simple.rs:12:5
2018-11-28 15:05:36 -06:00
|
LL | fn foo3<'a, 'b>(x: &'a usize, y: &'b usize) -> (&'b usize, &'a usize) {
| -- -- lifetime `'b` defined here
| |
| lifetime `'a` defined here
LL | (x, y)
| ^^^^^^ function was supposed to return data with lifetime `'b` but it is returning data with lifetime `'a`
2019-10-27 09:39:14 -05:00
|
= help: consider adding the following bound: `'a: 'b`
2018-11-28 15:05:36 -06:00
error: lifetime may not live long enough
2022-04-01 12:13:25 -05:00
--> $DIR/outlives-suggestion-simple.rs:12:5
2018-11-28 15:05:36 -06:00
|
LL | fn foo3<'a, 'b>(x: &'a usize, y: &'b usize) -> (&'b usize, &'a usize) {
| -- -- lifetime `'b` defined here
| |
| lifetime `'a` defined here
LL | (x, y)
| ^^^^^^ function was supposed to return data with lifetime `'a` but it is returning data with lifetime `'b`
|
2019-10-27 09:39:14 -05:00
= help: consider adding the following bound: `'b: 'a`
help: `'a` and `'b` must be the same: replace one with the other
2018-11-28 15:05:36 -06:00
error: lifetime may not live long enough
2022-04-01 12:13:25 -05:00
--> $DIR/outlives-suggestion-simple.rs:20:5
2018-11-28 15:05:36 -06:00
|
LL | fn foo4<'a, 'b, 'c>(x: &'a usize) -> (&'b usize, &'c usize) {
| -- -- lifetime `'b` defined here
| |
| lifetime `'a` defined here
...
LL | (x, x)
| ^^^^^^ function was supposed to return data with lifetime `'b` but it is returning data with lifetime `'a`
2018-11-28 15:05:36 -06:00
|
2019-10-27 09:39:14 -05:00
= help: consider adding the following bound: `'a: 'b`
2018-11-28 15:05:36 -06:00
error: lifetime may not live long enough
2022-04-01 12:13:25 -05:00
--> $DIR/outlives-suggestion-simple.rs:29:9
2018-11-28 15:05:36 -06:00
|
LL | pub fn foo<'a>(x: &'a usize) -> Self {
| -- lifetime `'a` defined here
LL | Foo { x }
| ^^^^^^^^^ returning this value requires that `'a` must outlive `'static`
error: lifetime may not live long enough
2022-04-01 12:13:25 -05:00
--> $DIR/outlives-suggestion-simple.rs:39:9
2018-11-28 15:05:36 -06:00
|
LL | impl<'a> Bar<'a> {
| -- lifetime `'a` defined here
LL | pub fn get<'b>(&self) -> &'b usize {
| -- lifetime `'b` defined here
LL | self.x
| ^^^^^^ associated function was supposed to return data with lifetime `'b` but it is returning data with lifetime `'a`
2018-11-28 15:05:36 -06:00
|
2019-10-27 09:39:14 -05:00
= help: consider adding the following bound: `'a: 'b`
2018-11-28 15:05:36 -06:00
error: lifetime may not live long enough
2022-04-01 12:13:25 -05:00
--> $DIR/outlives-suggestion-simple.rs:50:9
2018-11-28 15:05:36 -06:00
|
LL | impl<'a> Baz<'a> {
| -- lifetime `'a` defined here
LL | fn get<'b>(&'b self) -> &'a i32 {
| -- lifetime `'b` defined here
LL | self.x
| ^^^^^^ associated function was supposed to return data with lifetime `'a` but it is returning data with lifetime `'b`
2018-11-28 15:05:36 -06:00
|
2019-10-27 09:39:14 -05:00
= help: consider adding the following bound: `'b: 'a`
2018-11-28 15:05:36 -06:00
error: lifetime may not live long enough
2022-04-01 12:13:25 -05:00
--> $DIR/outlives-suggestion-simple.rs:71:9
2018-11-28 15:05:36 -06:00
|
LL | impl<'a> Foo2<'a> {
| -- lifetime `'a` defined here
LL | // should not produce outlives suggestions to name 'self
2018-11-28 15:05:36 -06:00
LL | fn get_bar(&self) -> Bar2 {
| - let's call the lifetime of this reference `'1`
2018-11-28 15:05:36 -06:00
LL | Bar2::new(&self)
| ^^^^^^^^^^^^^^^^ argument requires that `'1` must outlive `'a`
2018-11-28 15:05:36 -06:00
error: aborting due to 9 previous errors