]> git.lizzy.rs Git - rust.git/blob - tests/ui/variance/variance-use-invariant-struct-1.stderr
Add regression test for #42114
[rust.git] / tests / ui / variance / variance-use-invariant-struct-1.stderr
1 error: lifetime may not live long enough
2   --> $DIR/variance-use-invariant-struct-1.rs:10:5
3    |
4 LL | fn foo<'min,'max>(v: SomeStruct<&'max ()>)
5    |        ---- ---- lifetime `'max` defined here
6    |        |
7    |        lifetime `'min` defined here
8 ...
9 LL |     v
10    |     ^ function was supposed to return data with lifetime `'max` but it is returning data with lifetime `'min`
11    |
12    = help: consider adding the following bound: `'min: 'max`
13    = note: requirement occurs because of the type `SomeStruct<&()>`, which makes the generic argument `&()` invariant
14    = note: the struct `SomeStruct<T>` is invariant over the parameter `T`
15    = help: see <https://doc.rust-lang.org/nomicon/subtyping.html> for more information about variance
16
17 error: lifetime may not live long enough
18   --> $DIR/variance-use-invariant-struct-1.rs:18:5
19    |
20 LL | fn bar<'min,'max>(v: SomeStruct<&'min ()>)
21    |        ---- ---- lifetime `'max` defined here
22    |        |
23    |        lifetime `'min` defined here
24 ...
25 LL |     v
26    |     ^ function was supposed to return data with lifetime `'max` but it is returning data with lifetime `'min`
27    |
28    = help: consider adding the following bound: `'min: 'max`
29    = note: requirement occurs because of the type `SomeStruct<&()>`, which makes the generic argument `&()` invariant
30    = note: the struct `SomeStruct<T>` is invariant over the parameter `T`
31    = help: see <https://doc.rust-lang.org/nomicon/subtyping.html> for more information about variance
32
33 error: aborting due to 2 previous errors
34