]>
Commit | Line | Data |
---|---|---|
60c5eb7d | 1 | error: lifetime may not live long enough |
923072b8 | 2 | --> $DIR/outlives-suggestion-simple.rs:4:5 |
60c5eb7d XL |
3 | | |
4 | LL | fn foo1<'a, 'b>(x: &'a usize) -> &'b usize { | |
5 | | -- -- lifetime `'b` defined here | |
6 | | | | |
7 | | lifetime `'a` defined here | |
8 | LL | x | |
5099ac24 | 9 | | ^ function was supposed to return data with lifetime `'b` but it is returning data with lifetime `'a` |
60c5eb7d XL |
10 | | |
11 | = help: consider adding the following bound: `'a: 'b` | |
12 | ||
13 | error: lifetime may not live long enough | |
923072b8 | 14 | --> $DIR/outlives-suggestion-simple.rs:8:5 |
60c5eb7d XL |
15 | | |
16 | LL | fn foo2<'a>(x: &'a usize) -> &'static usize { | |
17 | | -- lifetime `'a` defined here | |
18 | LL | x | |
19 | | ^ returning this value requires that `'a` must outlive `'static` | |
60c5eb7d XL |
20 | |
21 | error: lifetime may not live long enough | |
923072b8 | 22 | --> $DIR/outlives-suggestion-simple.rs:12:5 |
60c5eb7d XL |
23 | | |
24 | LL | fn foo3<'a, 'b>(x: &'a usize, y: &'b usize) -> (&'b usize, &'a usize) { | |
25 | | -- -- lifetime `'b` defined here | |
26 | | | | |
27 | | lifetime `'a` defined here | |
28 | LL | (x, y) | |
29 | | ^^^^^^ function was supposed to return data with lifetime `'b` but it is returning data with lifetime `'a` | |
30 | | | |
31 | = help: consider adding the following bound: `'a: 'b` | |
32 | ||
33 | error: lifetime may not live long enough | |
923072b8 | 34 | --> $DIR/outlives-suggestion-simple.rs:12:5 |
60c5eb7d XL |
35 | | |
36 | LL | fn foo3<'a, 'b>(x: &'a usize, y: &'b usize) -> (&'b usize, &'a usize) { | |
37 | | -- -- lifetime `'b` defined here | |
38 | | | | |
39 | | lifetime `'a` defined here | |
40 | LL | (x, y) | |
41 | | ^^^^^^ function was supposed to return data with lifetime `'a` but it is returning data with lifetime `'b` | |
42 | | | |
43 | = help: consider adding the following bound: `'b: 'a` | |
44 | ||
45 | help: `'a` and `'b` must be the same: replace one with the other | |
46 | ||
47 | error: lifetime may not live long enough | |
923072b8 | 48 | --> $DIR/outlives-suggestion-simple.rs:20:5 |
60c5eb7d XL |
49 | | |
50 | LL | fn foo4<'a, 'b, 'c>(x: &'a usize) -> (&'b usize, &'c usize) { | |
51 | | -- -- lifetime `'b` defined here | |
52 | | | | |
53 | | lifetime `'a` defined here | |
54 | ... | |
55 | LL | (x, x) | |
5099ac24 | 56 | | ^^^^^^ function was supposed to return data with lifetime `'b` but it is returning data with lifetime `'a` |
60c5eb7d XL |
57 | | |
58 | = help: consider adding the following bound: `'a: 'b` | |
59 | ||
60 | error: lifetime may not live long enough | |
923072b8 | 61 | --> $DIR/outlives-suggestion-simple.rs:29:9 |
60c5eb7d XL |
62 | | |
63 | LL | pub fn foo<'a>(x: &'a usize) -> Self { | |
64 | | -- lifetime `'a` defined here | |
65 | LL | Foo { x } | |
66 | | ^^^^^^^^^ returning this value requires that `'a` must outlive `'static` | |
60c5eb7d XL |
67 | |
68 | error: lifetime may not live long enough | |
923072b8 | 69 | --> $DIR/outlives-suggestion-simple.rs:39:9 |
60c5eb7d XL |
70 | | |
71 | LL | impl<'a> Bar<'a> { | |
72 | | -- lifetime `'a` defined here | |
73 | LL | pub fn get<'b>(&self) -> &'b usize { | |
74 | | -- lifetime `'b` defined here | |
75 | LL | self.x | |
5099ac24 | 76 | | ^^^^^^ associated function was supposed to return data with lifetime `'b` but it is returning data with lifetime `'a` |
60c5eb7d XL |
77 | | |
78 | = help: consider adding the following bound: `'a: 'b` | |
79 | ||
80 | error: lifetime may not live long enough | |
923072b8 | 81 | --> $DIR/outlives-suggestion-simple.rs:50:9 |
60c5eb7d XL |
82 | | |
83 | LL | impl<'a> Baz<'a> { | |
84 | | -- lifetime `'a` defined here | |
85 | LL | fn get<'b>(&'b self) -> &'a i32 { | |
86 | | -- lifetime `'b` defined here | |
87 | LL | self.x | |
5099ac24 | 88 | | ^^^^^^ associated function was supposed to return data with lifetime `'a` but it is returning data with lifetime `'b` |
60c5eb7d XL |
89 | | |
90 | = help: consider adding the following bound: `'b: 'a` | |
91 | ||
5099ac24 | 92 | error: lifetime may not live long enough |
923072b8 | 93 | --> $DIR/outlives-suggestion-simple.rs:71:9 |
60c5eb7d | 94 | | |
c295e0f8 XL |
95 | LL | impl<'a> Foo2<'a> { |
96 | | -- lifetime `'a` defined here | |
97 | LL | // should not produce outlives suggestions to name 'self | |
60c5eb7d | 98 | LL | fn get_bar(&self) -> Bar2 { |
5099ac24 | 99 | | - let's call the lifetime of this reference `'1` |
60c5eb7d | 100 | LL | Bar2::new(&self) |
5099ac24 | 101 | | ^^^^^^^^^^^^^^^^ argument requires that `'1` must outlive `'a` |
60c5eb7d XL |
102 | |
103 | error: aborting due to 9 previous errors | |
104 |