File: ptr-is-invariant-over-v.stderr

package info (click to toggle)
rust-zerocopy 0.8.26-1
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 2,748 kB
  • sloc: sh: 116; makefile: 2
file content (31 lines) | stat: -rw-r--r-- 1,587 bytes parent folder | download
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
error: lifetime may not live long enough
  --> tests/ui-stable/ptr-is-invariant-over-v.rs:10:5
   |
6  | fn _when_exclusive<'big: 'small, 'small>(
   |                    ----          ------ lifetime `'small` defined here
   |                    |
   |                    lifetime `'big` defined here
...
10 |     _small = big;
   |     ^^^^^^^^^^^^ assignment requires that `'small` must outlive `'big`
   |
   = help: consider adding the following bound: `'small: 'big`
   = note: requirement occurs because of the type `Ptr<'_, &u32, (invariant::Exclusive, Aligned, Valid)>`, which makes the generic argument `&u32` invariant
   = note: the struct `Ptr<'a, T, I>` is invariant over the parameter `T`
   = help: see <https://doc.rust-lang.org/nomicon/subtyping.html> for more information about variance

error: lifetime may not live long enough
  --> tests/ui-stable/ptr-is-invariant-over-v.rs:17:5
   |
13 | fn _when_shared<'big: 'small, 'small>(
   |                 ----          ------ lifetime `'small` defined here
   |                 |
   |                 lifetime `'big` defined here
...
17 |     _small = big;
   |     ^^^^^^^^^^^^ assignment requires that `'small` must outlive `'big`
   |
   = help: consider adding the following bound: `'small: 'big`
   = note: requirement occurs because of the type `Ptr<'_, &u32, (Shared, Aligned, Valid)>`, which makes the generic argument `&u32` invariant
   = note: the struct `Ptr<'a, T, I>` is invariant over the parameter `T`
   = help: see <https://doc.rust-lang.org/nomicon/subtyping.html> for more information about variance