]> git.lizzy.rs Git - rust.git/blob - tests/ui/inference/issue-107090.stderr
Rollup merge of #107192 - fmease:mailmap-me-at-fmease-dev, r=albertlarsan68
[rust.git] / tests / ui / inference / issue-107090.stderr
1 error[E0261]: use of undeclared lifetime name `'short`
2   --> $DIR/issue-107090.rs:4:9
3    |
4 LL |     Foo<'short, 'out, T>: Convert<'a, 'b>;
5    |         ^^^^^^ undeclared lifetime
6    |
7    = note: for more information on higher-ranked polymorphism, visit https://doc.rust-lang.org/nomicon/hrtb.html
8 help: consider making the bound lifetime-generic with a new `'short` lifetime
9    |
10 LL |     for<'short> Foo<'short, 'out, T>: Convert<'a, 'b>;
11    |     +++++++++++
12 help: consider introducing lifetime `'short` here
13    |
14 LL | struct Foo<'short, 'a, 'b, T>(PhantomData<(&'a (), &'b (), T)>)
15    |            +++++++
16
17 error[E0261]: use of undeclared lifetime name `'out`
18   --> $DIR/issue-107090.rs:4:17
19    |
20 LL |     Foo<'short, 'out, T>: Convert<'a, 'b>;
21    |                 ^^^^ undeclared lifetime
22    |
23 help: consider making the bound lifetime-generic with a new `'out` lifetime
24    |
25 LL |     for<'out> Foo<'short, 'out, T>: Convert<'a, 'b>;
26    |     +++++++++
27 help: consider introducing lifetime `'out` here
28    |
29 LL | struct Foo<'out, 'a, 'b, T>(PhantomData<(&'a (), &'b (), T)>)
30    |            +++++
31
32 error[E0261]: use of undeclared lifetime name `'b`
33   --> $DIR/issue-107090.rs:13:47
34    |
35 LL | impl<'long: 'short, 'short, T> Convert<'long, 'b> for Foo<'short, 'out, T> {
36    |      -                                        ^^ undeclared lifetime
37    |      |
38    |      help: consider introducing lifetime `'b` here: `'b,`
39
40 error[E0261]: use of undeclared lifetime name `'out`
41   --> $DIR/issue-107090.rs:13:67
42    |
43 LL | impl<'long: 'short, 'short, T> Convert<'long, 'b> for Foo<'short, 'out, T> {
44    |      - help: consider introducing lifetime `'out` here: `'out,`   ^^^^ undeclared lifetime
45
46 error[E0261]: use of undeclared lifetime name `'out`
47   --> $DIR/issue-107090.rs:17:49
48    |
49 LL |     fn cast(&'long self) -> &'short Foo<'short, 'out, T> {
50    |                                                 ^^^^ undeclared lifetime
51    |
52 help: consider introducing lifetime `'out` here
53    |
54 LL |     fn cast<'out>(&'long self) -> &'short Foo<'short, 'out, T> {
55    |            ++++++
56 help: consider introducing lifetime `'out` here
57    |
58 LL | impl<'out, 'long: 'short, 'short, T> Convert<'long, 'b> for Foo<'short, 'out, T> {
59    |      +++++
60
61 error[E0261]: use of undeclared lifetime name `'short`
62   --> $DIR/issue-107090.rs:24:68
63    |
64 LL | fn badboi<'in_, 'out, T>(x: Foo<'in_, 'out, T>, sadness: &'in_ Foo<'short, 'out, T>) -> &'out T {
65    |           -                                                        ^^^^^^ undeclared lifetime
66    |           |
67    |           help: consider introducing lifetime `'short` here: `'short,`
68
69 error[E0308]: mismatched types
70   --> $DIR/issue-107090.rs:4:27
71    |
72 LL |     Foo<'short, 'out, T>: Convert<'a, 'b>;
73    |                           ^^^^^^^^^^^^^^^ lifetime mismatch
74    |
75    = note: expected trait `Convert<'static, 'static>`
76               found trait `Convert<'a, 'b>`
77 note: the lifetime `'a` as defined here...
78   --> $DIR/issue-107090.rs:2:12
79    |
80 LL | struct Foo<'a, 'b, T>(PhantomData<(&'a (), &'b (), T)>)
81    |            ^^
82    = note: ...does not necessarily outlive the static lifetime
83
84 error[E0308]: mismatched types
85   --> $DIR/issue-107090.rs:4:27
86    |
87 LL |     Foo<'short, 'out, T>: Convert<'a, 'b>;
88    |                           ^^^^^^^^^^^^^^^ lifetime mismatch
89    |
90    = note: expected trait `Convert<'static, 'static>`
91               found trait `Convert<'a, 'b>`
92 note: the lifetime `'b` as defined here...
93   --> $DIR/issue-107090.rs:2:16
94    |
95 LL | struct Foo<'a, 'b, T>(PhantomData<(&'a (), &'b (), T)>)
96    |                ^^
97    = note: ...does not necessarily outlive the static lifetime
98
99 error[E0495]: cannot infer an appropriate lifetime for lifetime parameter `'long` due to conflicting requirements
100   --> $DIR/issue-107090.rs:13:55
101    |
102 LL | impl<'long: 'short, 'short, T> Convert<'long, 'b> for Foo<'short, 'out, T> {
103    |                                                       ^^^^^^^^^^^^^^^^^^^^
104    |
105 note: first, the lifetime cannot outlive the lifetime `'short` as defined here...
106   --> $DIR/issue-107090.rs:13:21
107    |
108 LL | impl<'long: 'short, 'short, T> Convert<'long, 'b> for Foo<'short, 'out, T> {
109    |                     ^^^^^^
110    = note: ...but the lifetime must also be valid for the static lifetime...
111 note: ...so that the types are compatible
112   --> $DIR/issue-107090.rs:13:55
113    |
114 LL | impl<'long: 'short, 'short, T> Convert<'long, 'b> for Foo<'short, 'out, T> {
115    |                                                       ^^^^^^^^^^^^^^^^^^^^
116    = note: expected `Convert<'short, 'static>`
117               found `Convert<'_, 'static>`
118
119 error: incompatible lifetime on type
120   --> $DIR/issue-107090.rs:24:29
121    |
122 LL | fn badboi<'in_, 'out, T>(x: Foo<'in_, 'out, T>, sadness: &'in_ Foo<'short, 'out, T>) -> &'out T {
123    |                             ^^^^^^^^^^^^^^^^^^
124    |
125 note: because this has an unmet lifetime requirement
126   --> $DIR/issue-107090.rs:4:27
127    |
128 LL |     Foo<'short, 'out, T>: Convert<'a, 'b>;
129    |                           ^^^^^^^^^^^^^^^ introduces a `'static` lifetime requirement
130 note: the lifetime `'out` as defined here...
131   --> $DIR/issue-107090.rs:24:17
132    |
133 LL | fn badboi<'in_, 'out, T>(x: Foo<'in_, 'out, T>, sadness: &'in_ Foo<'short, 'out, T>) -> &'out T {
134    |                 ^^^^
135 note: ...does not necessarily outlive the static lifetime introduced by the compatible `impl`
136   --> $DIR/issue-107090.rs:13:1
137    |
138 LL | impl<'long: 'short, 'short, T> Convert<'long, 'b> for Foo<'short, 'out, T> {
139    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
140
141 error[E0759]: `x` has lifetime `'in_` but it needs to satisfy a `'static` lifetime requirement
142   --> $DIR/issue-107090.rs:24:29
143    |
144 LL | fn badboi<'in_, 'out, T>(x: Foo<'in_, 'out, T>, sadness: &'in_ Foo<'short, 'out, T>) -> &'out T {
145    |                             ^^^^^^^^^^^^^^^^^^
146    |                             |
147    |                             this data with lifetime `'in_`...
148    |                             ...is used and required to live as long as `'static` here
149
150 error[E0495]: cannot infer an appropriate lifetime for lifetime parameter `'long` due to conflicting requirements
151   --> $DIR/issue-107090.rs:17:13
152    |
153 LL |     fn cast(&'long self) -> &'short Foo<'short, 'out, T> {
154    |             ^^^^^^^^^^^
155    |
156 note: first, the lifetime cannot outlive the lifetime `'short` as defined here...
157   --> $DIR/issue-107090.rs:13:21
158    |
159 LL | impl<'long: 'short, 'short, T> Convert<'long, 'b> for Foo<'short, 'out, T> {
160    |                     ^^^^^^
161    = note: ...but the lifetime must also be valid for the static lifetime...
162 note: ...so that the types are compatible
163   --> $DIR/issue-107090.rs:17:13
164    |
165 LL |     fn cast(&'long self) -> &'short Foo<'short, 'out, T> {
166    |             ^^^^^^^^^^^
167    = note: expected `Convert<'short, 'static>`
168               found `Convert<'_, 'static>`
169
170 error: aborting due to 12 previous errors
171
172 Some errors have detailed explanations: E0261, E0308, E0495, E0759.
173 For more information about an error, try `rustc --explain E0261`.