summaryrefslogtreecommitdiffstats
path: root/src/test/ui/suggestions/return-elided-lifetime.stderr
blob: 273d95bc747d37b24c04b55f48b8ebb6f25bd1ed (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
error[E0106]: missing lifetime specifier
  --> $DIR/return-elided-lifetime.rs:6:12
   |
LL | fn f1() -> &i32 { loop {} }
   |            ^ expected named lifetime parameter
   |
   = help: this function's return type contains a borrowed value, but there is no value for it to be borrowed from
help: consider using the `'static` lifetime
   |
LL | fn f1() -> &'static i32 { loop {} }
   |             +++++++

error[E0106]: missing lifetime specifiers
  --> $DIR/return-elided-lifetime.rs:8:14
   |
LL | fn f1_() -> (&i32, &i32) { loop {} }
   |              ^     ^ expected named lifetime parameter
   |              |
   |              expected named lifetime parameter
   |
   = help: this function's return type contains a borrowed value, but there is no value for it to be borrowed from
help: consider using the `'static` lifetime
   |
LL | fn f1_() -> (&'static i32, &'static i32) { loop {} }
   |               +++++++       +++++++

error[E0106]: missing lifetime specifier
  --> $DIR/return-elided-lifetime.rs:11:26
   |
LL | fn f2(a: i32, b: i32) -> &i32 { loop {} }
   |                          ^ expected named lifetime parameter
   |
   = help: this function's return type contains a borrowed value, but there is no value for it to be borrowed from
help: consider using the `'static` lifetime
   |
LL | fn f2(a: i32, b: i32) -> &'static i32 { loop {} }
   |                           +++++++

error[E0106]: missing lifetime specifiers
  --> $DIR/return-elided-lifetime.rs:13:28
   |
LL | fn f2_(a: i32, b: i32) -> (&i32, &i32) { loop {} }
   |                            ^     ^ expected named lifetime parameter
   |                            |
   |                            expected named lifetime parameter
   |
   = help: this function's return type contains a borrowed value, but there is no value for it to be borrowed from
help: consider using the `'static` lifetime
   |
LL | fn f2_(a: i32, b: i32) -> (&'static i32, &'static i32) { loop {} }
   |                             +++++++       +++++++

error[E0106]: missing lifetime specifier
  --> $DIR/return-elided-lifetime.rs:17:17
   |
LL | fn f3(s: &S) -> &i32 { loop {} }
   |          --     ^ expected named lifetime parameter
   |
   = 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
help: consider introducing a named lifetime parameter
   |
LL | fn f3<'a>(s: &'a S<'a, 'a>) -> &'a i32 { loop {} }
   |      ++++     ++  ++++++++      ++

error[E0106]: missing lifetime specifiers
  --> $DIR/return-elided-lifetime.rs:19:26
   |
LL | fn f3_(s: &S, t: &S) -> (&i32, &i32) { loop {} }
   |           --     --      ^     ^ expected named lifetime parameter
   |                          |
   |                          expected named lifetime parameter
   |
   = 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
help: consider introducing a named lifetime parameter
   |
LL | fn f3_<'a>(s: &'a S<'a, 'a>, t: &'a S<'a, 'a>) -> (&'a i32, &'a i32) { loop {} }
   |       ++++     ++  ++++++++      ++  ++++++++       ++       ++

error[E0106]: missing lifetime specifier
  --> $DIR/return-elided-lifetime.rs:22:42
   |
LL | fn f4<'a, 'b>(a: &'a i32, b: &'b i32) -> &i32 { loop {} }
   |                  -------     -------     ^ expected named lifetime parameter
   |
   = help: this function's return type contains a borrowed value with an elided lifetime, but the lifetime cannot be derived from the arguments
note: these named lifetimes are available to use
  --> $DIR/return-elided-lifetime.rs:22:7
   |
LL | fn f4<'a, 'b>(a: &'a i32, b: &'b i32) -> &i32 { loop {} }
   |       ^^  ^^
help: consider using one of the available lifetimes here
   |
LL | fn f4<'a, 'b>(a: &'a i32, b: &'b i32) -> &'lifetime i32 { loop {} }
   |                                           +++++++++

error[E0106]: missing lifetime specifiers
  --> $DIR/return-elided-lifetime.rs:24:44
   |
LL | fn f4_<'a, 'b>(a: &'a i32, b: &'b i32) -> (&i32, &i32) { loop {} }
   |                   -------     -------      ^     ^ expected named lifetime parameter
   |                                            |
   |                                            expected named lifetime parameter
   |
   = help: this function's return type contains a borrowed value with an elided lifetime, but the lifetime cannot be derived from the arguments
note: these named lifetimes are available to use
  --> $DIR/return-elided-lifetime.rs:24:8
   |
LL | fn f4_<'a, 'b>(a: &'a i32, b: &'b i32) -> (&i32, &i32) { loop {} }
   |        ^^  ^^
help: consider using one of the available lifetimes here
   |
LL | fn f4_<'a, 'b>(a: &'a i32, b: &'b i32) -> (&'lifetime i32, &'lifetime i32) { loop {} }
   |                                             +++++++++       +++++++++

error[E0106]: missing lifetime specifier
  --> $DIR/return-elided-lifetime.rs:27:35
   |
LL | fn f5<'a>(a: &'a i32, b: &i32) -> &i32 { loop {} }
   |              -------     ----     ^ expected named lifetime parameter
   |
   = help: this function's return type contains a borrowed value, but the signature does not say whether it is borrowed from `a` or `b`
help: consider using the `'a` lifetime
   |
LL | fn f5<'a>(a: &'a i32, b: &i32) -> &'a i32 { loop {} }
   |                                    ++

error[E0106]: missing lifetime specifiers
  --> $DIR/return-elided-lifetime.rs:29:37
   |
LL | fn f5_<'a>(a: &'a i32, b: &i32) -> (&i32, &i32) { loop {} }
   |               -------     ----      ^     ^ expected named lifetime parameter
   |                                     |
   |                                     expected named lifetime parameter
   |
   = help: this function's return type contains a borrowed value, but the signature does not say whether it is borrowed from `a` or `b`
help: consider using the `'a` lifetime
   |
LL | fn f5_<'a>(a: &'a i32, b: &i32) -> (&'a i32, &'a i32) { loop {} }
   |                                      ++       ++

error: aborting due to 10 previous errors

For more information about this error, try `rustc --explain E0106`.