]> git.lizzy.rs Git - rust.git/blob - src/test/ui/lifetimes/lifetime-elision-return-type-requires-explicit-lifetime.stderr
Rollup merge of #89588 - BoxyUwU:add_a_test_uwu, r=lcnr
[rust.git] / src / test / ui / lifetimes / lifetime-elision-return-type-requires-explicit-lifetime.stderr
1 error[E0106]: missing lifetime specifier
2   --> $DIR/lifetime-elision-return-type-requires-explicit-lifetime.rs:2:11
3    |
4 LL | fn f() -> &isize {
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 f() -> &'static isize {
11    |           ~~~~~~~~
12
13 error[E0106]: missing lifetime specifier
14   --> $DIR/lifetime-elision-return-type-requires-explicit-lifetime.rs:7:33
15    |
16 LL | fn g(_x: &isize, _y: &isize) -> &isize {
17    |          ------      ------     ^ expected named lifetime parameter
18    |
19    = help: this function's return type contains a borrowed value, but the signature does not say whether it is borrowed from `_x` or `_y`
20 help: consider introducing a named lifetime parameter
21    |
22 LL | fn g<'a>(_x: &'a isize, _y: &'a isize) -> &'a isize {
23    |     ++++      ++             ++            ++
24
25 error[E0106]: missing lifetime specifier
26   --> $DIR/lifetime-elision-return-type-requires-explicit-lifetime.rs:17:19
27    |
28 LL | fn h(_x: &Foo) -> &isize {
29    |          ----     ^ expected named lifetime parameter
30    |
31    = help: this function's return type contains a borrowed value, but the signature does not say which one of `_x`'s 2 lifetimes it is borrowed from
32 help: consider introducing a named lifetime parameter
33    |
34 LL | fn h<'a>(_x: &'a Foo) -> &'a isize {
35    |     ++++      ++          ++
36
37 error[E0106]: missing lifetime specifier
38   --> $DIR/lifetime-elision-return-type-requires-explicit-lifetime.rs:21:20
39    |
40 LL | fn i(_x: isize) -> &isize {
41    |                    ^ expected named lifetime parameter
42    |
43    = help: this function's return type contains a borrowed value with an elided lifetime, but the lifetime cannot be derived from the arguments
44 help: consider using the `'static` lifetime
45    |
46 LL | fn i(_x: isize) -> &'static isize {
47    |                    ~~~~~~~~
48
49 error[E0106]: missing lifetime specifier
50   --> $DIR/lifetime-elision-return-type-requires-explicit-lifetime.rs:34:24
51    |
52 LL | fn j(_x: StaticStr) -> &isize {
53    |                        ^ expected named lifetime parameter
54    |
55    = help: this function's return type contains a borrowed value with an elided lifetime, but the lifetime cannot be derived from the arguments
56 help: consider using the `'static` lifetime
57    |
58 LL | fn j(_x: StaticStr) -> &'static isize {
59    |                        ~~~~~~~~
60
61 error[E0106]: missing lifetime specifier
62   --> $DIR/lifetime-elision-return-type-requires-explicit-lifetime.rs:40:49
63    |
64 LL | fn k<'a, T: WithLifetime<'a>>(_x: T::Output) -> &isize {
65    |                                                 ^ expected named lifetime parameter
66    |
67    = help: this function's return type contains a borrowed value with an elided lifetime, but the lifetime cannot be derived from the arguments
68 help: consider using the `'a` lifetime
69    |
70 LL | fn k<'a, T: WithLifetime<'a>>(_x: T::Output) -> &'a isize {
71    |                                                 ~~~
72
73 error: aborting due to 6 previous errors
74
75 For more information about this error, try `rustc --explain E0106`.