summaryrefslogtreecommitdiffstats
path: root/tests/ui/consts/const-eval/ub-incorrect-vtable.64bit.stderr
blob: bd542a7a5f2933351c4c45ee9f6dca7550402ff9 (plain)
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
error[E0080]: evaluation of constant value failed
  --> $DIR/ub-incorrect-vtable.rs:19:14
   |
LL |     unsafe { std::mem::transmute((&92u8, &[0usize, 1usize, 1000usize])) };
   |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ using allocN as vtable pointer but it does not point to a vtable

error[E0080]: evaluation of constant value failed
  --> $DIR/ub-incorrect-vtable.rs:24:14
   |
LL |     unsafe { std::mem::transmute((&92u8, &[1usize, usize::MAX, 1usize])) };
   |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ using allocN as vtable pointer but it does not point to a vtable

error[E0080]: it is undefined behavior to use this value
  --> $DIR/ub-incorrect-vtable.rs:33:1
   |
LL | const INVALID_VTABLE_ALIGNMENT_UB: W<&dyn Trait> =
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .0: encountered allocN, but expected a vtable pointer
   |
   = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
   = note: the raw bytes of the constant (size: 16, align: 8) {
               ╾───────allocN───────╼ ╾───────allocN───────╼ │ ╾──────╼╾──────╼
           }

error[E0080]: it is undefined behavior to use this value
  --> $DIR/ub-incorrect-vtable.rs:38:1
   |
LL | const INVALID_VTABLE_SIZE_UB: W<&dyn Trait> =
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .0: encountered allocN, but expected a vtable pointer
   |
   = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
   = note: the raw bytes of the constant (size: 16, align: 8) {
               ╾───────allocN───────╼ ╾───────allocN───────╼ │ ╾──────╼╾──────╼
           }

error[E0080]: it is undefined behavior to use this value
  --> $DIR/ub-incorrect-vtable.rs:44:1
   |
LL | const INVALID_VTABLE_UB: W<&dyn Trait> =
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .0: encountered allocN, but expected a vtable pointer
   |
   = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
   = note: the raw bytes of the constant (size: 16, align: 8) {
               ╾───────allocN───────╼ ╾───────allocN───────╼ │ ╾──────╼╾──────╼
           }

error[E0080]: it is undefined behavior to use this value
  --> $DIR/ub-incorrect-vtable.rs:91:1
   |
LL | const G: Wide = unsafe { Transmute { t: FOO }.u };
   | ^^^^^^^^^^^^^ constructing invalid value at .1: encountered a dangling reference (going beyond the bounds of its allocation)
   |
   = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
   = note: the raw bytes of the constant (size: 16, align: 8) {
               ╾───────allocN───────╼ ╾───────allocN───────╼ │ ╾──────╼╾──────╼
           }

error: aborting due to 6 previous errors

For more information about this error, try `rustc --explain E0080`.