1 error: lifetime may not live long enough
2 --> $DIR/outlives-suggestion-simple.rs:6:5
4 LL | fn foo1<'a, 'b>(x: &'a usize) -> &'b usize {
5 | -- -- lifetime `'b` defined here
7 | lifetime `'a` defined here
9 | ^ returning this value requires that `'a` must outlive `'b`
11 = help: consider adding the following bound: `'a: 'b`
13 error: lifetime may not live long enough
14 --> $DIR/outlives-suggestion-simple.rs:10:5
16 LL | fn foo2<'a>(x: &'a usize) -> &'static usize {
17 | -- lifetime `'a` defined here
19 | ^ returning this value requires that `'a` must outlive `'static`
21 = help: consider replacing `'a` with `'static`
23 error: lifetime may not live long enough
24 --> $DIR/outlives-suggestion-simple.rs:14:5
26 LL | fn foo3<'a, 'b>(x: &'a usize, y: &'b usize) -> (&'b usize, &'a usize) {
27 | -- -- lifetime `'b` defined here
29 | lifetime `'a` defined here
31 | ^^^^^^ function was supposed to return data with lifetime `'b` but it is returning data with lifetime `'a`
33 = help: consider adding the following bound: `'a: 'b`
35 error: lifetime may not live long enough
36 --> $DIR/outlives-suggestion-simple.rs:14:5
38 LL | fn foo3<'a, 'b>(x: &'a usize, y: &'b usize) -> (&'b usize, &'a usize) {
39 | -- -- lifetime `'b` defined here
41 | lifetime `'a` defined here
43 | ^^^^^^ function was supposed to return data with lifetime `'a` but it is returning data with lifetime `'b`
45 = help: consider adding the following bound: `'b: 'a`
47 help: `'a` and `'b` must be the same: replace one with the other
49 error: lifetime may not live long enough
50 --> $DIR/outlives-suggestion-simple.rs:22:5
52 LL | fn foo4<'a, 'b, 'c>(x: &'a usize) -> (&'b usize, &'c usize) {
53 | -- -- lifetime `'b` defined here
55 | lifetime `'a` defined here
58 | ^^^^^^ returning this value requires that `'a` must outlive `'b`
60 = help: consider adding the following bound: `'a: 'b`
62 error: lifetime may not live long enough
63 --> $DIR/outlives-suggestion-simple.rs:22:5
65 LL | fn foo4<'a, 'b, 'c>(x: &'a usize) -> (&'b usize, &'c usize) {
66 | -- -- lifetime `'c` defined here
68 | lifetime `'a` defined here
71 | ^^^^^^ returning this value requires that `'a` must outlive `'c`
73 = help: consider adding the following bound: `'a: 'c`
75 help: add bound `'a: 'b + 'c`
77 error: lifetime may not live long enough
78 --> $DIR/outlives-suggestion-simple.rs:31:9
80 LL | pub fn foo<'a>(x: &'a usize) -> Self {
81 | -- lifetime `'a` defined here
83 | ^^^^^^^^^ returning this value requires that `'a` must outlive `'static`
85 = help: consider replacing `'a` with `'static`
87 error: lifetime may not live long enough
88 --> $DIR/outlives-suggestion-simple.rs:41:9
90 LL | impl<'a> Bar<'a> {
91 | -- lifetime `'a` defined here
92 LL | pub fn get<'b>(&self) -> &'b usize {
93 | -- lifetime `'b` defined here
95 | ^^^^^^ returning this value requires that `'a` must outlive `'b`
97 = help: consider adding the following bound: `'a: 'b`
99 error: lifetime may not live long enough
100 --> $DIR/outlives-suggestion-simple.rs:52:9
102 LL | impl<'a> Baz<'a> {
103 | -- lifetime `'a` defined here
104 LL | fn get<'b>(&'b self) -> &'a i32 {
105 | -- lifetime `'b` defined here
107 | ^^^^^^ returning this value requires that `'b` must outlive `'a`
109 = help: consider adding the following bound: `'b: 'a`
111 error[E0521]: borrowed data escapes outside of associated function
112 --> $DIR/outlives-suggestion-simple.rs:73:9
114 LL | fn get_bar(&self) -> Bar2 {
117 | `self` declared here, outside of the associated function body
118 | `self` is a reference that is only valid in the associated function body
119 LL | Bar2::new(&self)
120 | ^^^^^^^^^^^^^^^^ `self` escapes the associated function body here
122 error: aborting due to 10 previous errors