]> git.lizzy.rs Git - rust.git/blob - src/test/ui/variance/variance-cell-is-invariant.nll.stderr
Rollup merge of #94248 - compiler-errors:fix-while-loop-bad-delay, r=petrochenkov
[rust.git] / src / test / ui / variance / variance-cell-is-invariant.nll.stderr
1 error: lifetime may not live long enough
2   --> $DIR/variance-cell-is-invariant.rs:14:12
3    |
4 LL | fn use_<'short,'long>(c: Foo<'short>,
5    |         ------ ----- lifetime `'long` defined here
6    |         |
7    |         lifetime `'short` defined here
8 ...
9 LL |     let _: Foo<'long> = c;
10    |            ^^^^^^^^^^ type annotation requires that `'short` must outlive `'long`
11    |
12    = help: consider adding the following bound: `'short: 'long`
13    = note: requirement occurs because of the type Foo<'_>, which makes the generic argument '_ invariant
14    = note: the struct Foo<'a> is invariant over the parameter 'a
15    = help: see <https://doc.rust-lang.org/nomicon/subtyping.html> for more information about variance
16
17 error: aborting due to previous error
18