|
| 1 | +error: lifetime may not live long enough |
| 2 | + --> tests/ui-nightly/ptr-is-invariant-over-v.rs:10:5 |
| 3 | + | |
| 4 | +6 | fn _when_exclusive<'big: 'small, 'small>( |
| 5 | + | ---- ------ lifetime `'small` defined here |
| 6 | + | | |
| 7 | + | lifetime `'big` defined here |
| 8 | +... |
| 9 | +10 | _small = big; |
| 10 | + | ^^^^^^^^^^^^ assignment requires that `'small` must outlive `'big` |
| 11 | + | |
| 12 | + = help: consider adding the following bound: `'small: 'big` |
| 13 | + = note: requirement occurs because of the type `Ptr<'_, &u32, (invariant::Exclusive, Aligned, Valid)>`, which makes the generic argument `&u32` invariant |
| 14 | + = note: the struct `Ptr<'a, T, I>` 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 | + --> tests/ui-nightly/ptr-is-invariant-over-v.rs:17:5 |
| 19 | + | |
| 20 | +13 | fn _when_shared<'big: 'small, 'small>( |
| 21 | + | ---- ------ lifetime `'small` defined here |
| 22 | + | | |
| 23 | + | lifetime `'big` defined here |
| 24 | +... |
| 25 | +17 | _small = big; |
| 26 | + | ^^^^^^^^^^^^ assignment requires that `'small` must outlive `'big` |
| 27 | + | |
| 28 | + = help: consider adding the following bound: `'small: 'big` |
| 29 | + = note: requirement occurs because of the type `Ptr<'_, &u32, (Shared, Aligned, Valid)>`, which makes the generic argument `&u32` invariant |
| 30 | + = note: the struct `Ptr<'a, T, I>` is invariant over the parameter `T` |
| 31 | + = help: see <https://doc.rust-lang.org/nomicon/subtyping.html> for more information about variance |
0 commit comments