|
| 1 | +error: any use of this value will cause an error |
| 2 | + --> $DIR/ub-incorrect-vtable.rs:19:14 |
| 3 | + | |
| 4 | +LL | / const INVALID_VTABLE_ALIGNMENT: &dyn Trait = |
| 5 | +LL | | unsafe { std::mem::transmute((&92u8, &[0usize, 1usize, 1000usize])) }; |
| 6 | + | |______________^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^__- |
| 7 | + | | |
| 8 | + | invalid vtable: alignment `1000` is not a power of 2 |
| 9 | + | |
| 10 | + = note: `#[deny(const_err)]` on by default |
| 11 | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! |
| 12 | + = note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800> |
| 13 | + |
| 14 | +error: any use of this value will cause an error |
| 15 | + --> $DIR/ub-incorrect-vtable.rs:25:14 |
| 16 | + | |
| 17 | +LL | / const INVALID_VTABLE_SIZE: &dyn Trait = |
| 18 | +LL | | unsafe { std::mem::transmute((&92u8, &[1usize, usize::MAX, 1usize])) }; |
| 19 | + | |______________^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^__- |
| 20 | + | | |
| 21 | + | invalid vtable: size is bigger than largest supported object |
| 22 | + | |
| 23 | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! |
| 24 | + = note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800> |
| 25 | + |
| 26 | +error[E0080]: it is undefined behavior to use this value |
| 27 | + --> $DIR/ub-incorrect-vtable.rs:36:1 |
| 28 | + | |
| 29 | +LL | / const INVALID_VTABLE_ALIGNMENT_UB: W<&dyn Trait> = |
| 30 | +LL | | unsafe { std::mem::transmute((&92u8, &(drop_me as fn(*mut usize), 1usize, 1000usize))) }; |
| 31 | + | |_____________________________________________________________________________________________^ type validation failed: encountered invalid vtable: alignment `1000` is not a power of 2 at .0 |
| 32 | + | |
| 33 | + = 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. |
| 34 | + = note: the raw bytes of the constant (size: 16, align: 8) { |
| 35 | + ╾───────allocN───────╼ ╾───────allocN───────╼ │ ╾──────╼╾──────╼ |
| 36 | + } |
| 37 | + |
| 38 | +error[E0080]: it is undefined behavior to use this value |
| 39 | + --> $DIR/ub-incorrect-vtable.rs:41:1 |
| 40 | + | |
| 41 | +LL | / const INVALID_VTABLE_SIZE_UB: W<&dyn Trait> = |
| 42 | +LL | | unsafe { std::mem::transmute((&92u8, &(drop_me as fn(*mut usize), usize::MAX, 1usize))) }; |
| 43 | + | |______________________________________________________________________________________________^ type validation failed: encountered invalid vtable: size is bigger than largest supported object at .0 |
| 44 | + | |
| 45 | + = 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. |
| 46 | + = note: the raw bytes of the constant (size: 16, align: 8) { |
| 47 | + ╾───────allocN───────╼ ╾───────allocN───────╼ │ ╾──────╼╾──────╼ |
| 48 | + } |
| 49 | + |
| 50 | +error: aborting due to 4 previous errors |
| 51 | + |
| 52 | +For more information about this error, try `rustc --explain E0080`. |
0 commit comments