]> git.lizzy.rs Git - rust.git/blob - tests/ui/suggestions/return-elided-lifetime.stderr
Rollup merge of #105795 - nicholasbishop:bishop-stabilize-efiapi, r=joshtriplett
[rust.git] / tests / ui / suggestions / return-elided-lifetime.stderr
1 error[E0106]: missing lifetime specifier
2   --> $DIR/return-elided-lifetime.rs:6:12
3    |
4 LL | fn f1() -> &i32 { loop {} }
5    |            ^ expected named lifetime parameter
6    |
7    = help: this function's return type contains a borrowed value, but there is no value for it to be borrowed from
8 help: consider using the `'static` lifetime
9    |
10 LL | fn f1() -> &'static i32 { loop {} }
11    |             +++++++
12
13 error[E0106]: missing lifetime specifiers
14   --> $DIR/return-elided-lifetime.rs:8:14
15    |
16 LL | fn f1_() -> (&i32, &i32) { loop {} }
17    |              ^     ^ expected named lifetime parameter
18    |              |
19    |              expected named lifetime parameter
20    |
21    = help: this function's return type contains a borrowed value, but there is no value for it to be borrowed from
22 help: consider using the `'static` lifetime
23    |
24 LL | fn f1_() -> (&'static i32, &'static i32) { loop {} }
25    |               +++++++       +++++++
26
27 error[E0106]: missing lifetime specifier
28   --> $DIR/return-elided-lifetime.rs:11:26
29    |
30 LL | fn f2(a: i32, b: i32) -> &i32 { loop {} }
31    |                          ^ expected named lifetime parameter
32    |
33    = help: this function's return type contains a borrowed value, but there is no value for it to be borrowed from
34 help: consider using the `'static` lifetime
35    |
36 LL | fn f2(a: i32, b: i32) -> &'static i32 { loop {} }
37    |                           +++++++
38
39 error[E0106]: missing lifetime specifiers
40   --> $DIR/return-elided-lifetime.rs:13:28
41    |
42 LL | fn f2_(a: i32, b: i32) -> (&i32, &i32) { loop {} }
43    |                            ^     ^ expected named lifetime parameter
44    |                            |
45    |                            expected named lifetime parameter
46    |
47    = help: this function's return type contains a borrowed value, but there is no value for it to be borrowed from
48 help: consider using the `'static` lifetime
49    |
50 LL | fn f2_(a: i32, b: i32) -> (&'static i32, &'static i32) { loop {} }
51    |                             +++++++       +++++++
52
53 error[E0106]: missing lifetime specifier
54   --> $DIR/return-elided-lifetime.rs:17:17
55    |
56 LL | fn f3(s: &S) -> &i32 { loop {} }
57    |          --     ^ expected named lifetime parameter
58    |
59    = help: this function's return type contains a borrowed value, but the signature does not say which one of `s`'s 3 lifetimes it is borrowed from
60 help: consider introducing a named lifetime parameter
61    |
62 LL | fn f3<'a>(s: &'a S<'a, 'a>) -> &'a i32 { loop {} }
63    |      ++++     ++  ++++++++      ++
64
65 error[E0106]: missing lifetime specifiers
66   --> $DIR/return-elided-lifetime.rs:19:26
67    |
68 LL | fn f3_(s: &S, t: &S) -> (&i32, &i32) { loop {} }
69    |           --     --      ^     ^ expected named lifetime parameter
70    |                          |
71    |                          expected named lifetime parameter
72    |
73    = help: this function's return type contains a borrowed value, but the signature does not say whether it is borrowed from one of `s`'s 3 lifetimes or one of `t`'s 3 lifetimes
74 help: consider introducing a named lifetime parameter
75    |
76 LL | fn f3_<'a>(s: &'a S<'a, 'a>, t: &'a S<'a, 'a>) -> (&'a i32, &'a i32) { loop {} }
77    |       ++++     ++  ++++++++      ++  ++++++++       ++       ++
78
79 error[E0106]: missing lifetime specifier
80   --> $DIR/return-elided-lifetime.rs:22:42
81    |
82 LL | fn f4<'a, 'b>(a: &'a i32, b: &'b i32) -> &i32 { loop {} }
83    |                  -------     -------     ^ expected named lifetime parameter
84    |
85    = help: this function's return type contains a borrowed value with an elided lifetime, but the lifetime cannot be derived from the arguments
86 note: these named lifetimes are available to use
87   --> $DIR/return-elided-lifetime.rs:22:7
88    |
89 LL | fn f4<'a, 'b>(a: &'a i32, b: &'b i32) -> &i32 { loop {} }
90    |       ^^  ^^
91 help: consider using one of the available lifetimes here
92    |
93 LL | fn f4<'a, 'b>(a: &'a i32, b: &'b i32) -> &'lifetime i32 { loop {} }
94    |                                           +++++++++
95
96 error[E0106]: missing lifetime specifiers
97   --> $DIR/return-elided-lifetime.rs:24:44
98    |
99 LL | fn f4_<'a, 'b>(a: &'a i32, b: &'b i32) -> (&i32, &i32) { loop {} }
100    |                   -------     -------      ^     ^ expected named lifetime parameter
101    |                                            |
102    |                                            expected named lifetime parameter
103    |
104    = help: this function's return type contains a borrowed value with an elided lifetime, but the lifetime cannot be derived from the arguments
105 note: these named lifetimes are available to use
106   --> $DIR/return-elided-lifetime.rs:24:8
107    |
108 LL | fn f4_<'a, 'b>(a: &'a i32, b: &'b i32) -> (&i32, &i32) { loop {} }
109    |        ^^  ^^
110 help: consider using one of the available lifetimes here
111    |
112 LL | fn f4_<'a, 'b>(a: &'a i32, b: &'b i32) -> (&'lifetime i32, &'lifetime i32) { loop {} }
113    |                                             +++++++++       +++++++++
114
115 error[E0106]: missing lifetime specifier
116   --> $DIR/return-elided-lifetime.rs:27:35
117    |
118 LL | fn f5<'a>(a: &'a i32, b: &i32) -> &i32 { loop {} }
119    |              -------     ----     ^ expected named lifetime parameter
120    |
121    = help: this function's return type contains a borrowed value, but the signature does not say whether it is borrowed from `a` or `b`
122 help: consider using the `'a` lifetime
123    |
124 LL | fn f5<'a>(a: &'a i32, b: &i32) -> &'a i32 { loop {} }
125    |                                    ++
126
127 error[E0106]: missing lifetime specifiers
128   --> $DIR/return-elided-lifetime.rs:29:37
129    |
130 LL | fn f5_<'a>(a: &'a i32, b: &i32) -> (&i32, &i32) { loop {} }
131    |               -------     ----      ^     ^ expected named lifetime parameter
132    |                                     |
133    |                                     expected named lifetime parameter
134    |
135    = help: this function's return type contains a borrowed value, but the signature does not say whether it is borrowed from `a` or `b`
136 help: consider using the `'a` lifetime
137    |
138 LL | fn f5_<'a>(a: &'a i32, b: &i32) -> (&'a i32, &'a i32) { loop {} }
139    |                                      ++       ++
140
141 error: aborting due to 10 previous errors
142
143 For more information about this error, try `rustc --explain E0106`.