]> git.lizzy.rs Git - rust.git/blob - src/test/ui/nll/outlives-suggestion-simple.stderr
Rollup merge of #103146 - joboet:cleanup_pthread_condvar, r=Mark-Simulacrum
[rust.git] / src / test / ui / nll / outlives-suggestion-simple.stderr
1 error: lifetime may not live long enough
2   --> $DIR/outlives-suggestion-simple.rs:4:5
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
9    |     ^ function was supposed to return data with lifetime `'b` but it is returning data with lifetime `'a`
10    |
11    = help: consider adding the following bound: `'a: 'b`
12
13 error: lifetime may not live long enough
14   --> $DIR/outlives-suggestion-simple.rs:8:5
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`
20
21 error: lifetime may not live long enough
22   --> $DIR/outlives-suggestion-simple.rs:12:5
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
34   --> $DIR/outlives-suggestion-simple.rs:12:5
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
48   --> $DIR/outlives-suggestion-simple.rs:20:5
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)
56    |     ^^^^^^ function was supposed to return data with lifetime `'b` but it is returning data with lifetime `'a`
57    |
58    = help: consider adding the following bound: `'a: 'b`
59
60 error: lifetime may not live long enough
61   --> $DIR/outlives-suggestion-simple.rs:29:9
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`
67
68 error: lifetime may not live long enough
69   --> $DIR/outlives-suggestion-simple.rs:39:9
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
76    |         ^^^^^^ associated function was supposed to return data with lifetime `'b` but it is returning data with lifetime `'a`
77    |
78    = help: consider adding the following bound: `'a: 'b`
79
80 error: lifetime may not live long enough
81   --> $DIR/outlives-suggestion-simple.rs:50:9
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
88    |         ^^^^^^ associated function was supposed to return data with lifetime `'a` but it is returning data with lifetime `'b`
89    |
90    = help: consider adding the following bound: `'b: 'a`
91
92 error: lifetime may not live long enough
93   --> $DIR/outlives-suggestion-simple.rs:71:9
94    |
95 LL | impl<'a> Foo2<'a> {
96    |      -- lifetime `'a` defined here
97 LL |     // should not produce outlives suggestions to name 'self
98 LL |     fn get_bar(&self) -> Bar2 {
99    |                - let's call the lifetime of this reference `'1`
100 LL |         Bar2::new(&self)
101    |         ^^^^^^^^^^^^^^^^ argument requires that `'1` must outlive `'a`
102
103 error: aborting due to 9 previous errors
104