fork/rust

git clone https://git.julia.blue/fork/rust

borsAuto merge of #103046 - JanBeh:PR_clarify_cmp_terminology, r=workingjubilee3bcad65fbf6

master
3.7 KiB104 linesraw
1error: lifetime may not live long enough
2  --> $DIR/outlives-suggestion-simple.rs:4:5
3   |
4LL | fn foo1<'a, 'b>(x: &'a usize) -> &'b usize {
5   |         --  -- lifetime `'b` defined here
6   |         |
7   |         lifetime `'a` defined here
8LL |     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
13error: lifetime may not live long enough
14  --> $DIR/outlives-suggestion-simple.rs:8:5
15   |
16LL | fn foo2<'a>(x: &'a usize) -> &'static usize {
17   |         -- lifetime `'a` defined here
18LL |     x
19   |     ^ returning this value requires that `'a` must outlive `'static`
20
21error: lifetime may not live long enough
22  --> $DIR/outlives-suggestion-simple.rs:12:5
23   |
24LL | 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
28LL |     (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
33error: lifetime may not live long enough
34  --> $DIR/outlives-suggestion-simple.rs:12:5
35   |
36LL | 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
40LL |     (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
45help: `'a` and `'b` must be the same: replace one with the other
46
47error: lifetime may not live long enough
48  --> $DIR/outlives-suggestion-simple.rs:20:5
49   |
50LL | fn foo4<'a, 'b, 'c>(x: &'a usize) -> (&'b usize, &'c usize) {
51   |         --  -- lifetime `'b` defined here
52   |         |
53   |         lifetime `'a` defined here
54...
55LL |     (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
60error: lifetime may not live long enough
61  --> $DIR/outlives-suggestion-simple.rs:29:9
62   |
63LL |     pub fn foo<'a>(x: &'a usize) -> Self {
64   |                -- lifetime `'a` defined here
65LL |         Foo { x }
66   |         ^^^^^^^^^ returning this value requires that `'a` must outlive `'static`
67
68error: lifetime may not live long enough
69  --> $DIR/outlives-suggestion-simple.rs:39:9
70   |
71LL | impl<'a> Bar<'a> {
72   |      -- lifetime `'a` defined here
73LL |     pub fn get<'b>(&self) -> &'b usize {
74   |                -- lifetime `'b` defined here
75LL |         self.x
76   |         ^^^^^^ method 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
80error: lifetime may not live long enough
81  --> $DIR/outlives-suggestion-simple.rs:50:9
82   |
83LL | impl<'a> Baz<'a> {
84   |      -- lifetime `'a` defined here
85LL |     fn get<'b>(&'b self) -> &'a i32 {
86   |            -- lifetime `'b` defined here
87LL |         self.x
88   |         ^^^^^^ method 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
92error: lifetime may not live long enough
93  --> $DIR/outlives-suggestion-simple.rs:71:9
94   |
95LL | impl<'a> Foo2<'a> {
96   |      -- lifetime `'a` defined here
97LL |     // should not produce outlives suggestions to name 'self
98LL |     fn get_bar(&self) -> Bar2 {
99   |                - let's call the lifetime of this reference `'1`
100LL |         Bar2::new(&self)
101   |         ^^^^^^^^^^^^^^^^ argument requires that `'1` must outlive `'a`
102
103error: aborting due to 9 previous errors
104