Closed
Description
With:
#![feature(arbitrary_enum_discriminant)]
#[repr(u8)]
enum Beta {
V1 = 41,
V2() = Self::V2 as u8 + 1,
}
something seemingly strange is going on:
error[E0658]: casting pointers to integers in constants is unstable
--> src/lib.rs:6:12
|
6 | V2() = Self::V2 as u8 + 1,
| ^^^^^^^^^^^^^^
|
= note: for more information, see https://github.com/rust-lang/rust/issues/51910
= help: add `#![feature(const_raw_ptr_to_usize_cast)]` to the crate attributes to enable
error[E0080]: evaluation of constant value failed
--> src/lib.rs:6:12
|
6 | V2() = Self::V2 as u8 + 1,
| ^^^^^^^^^^^^^^ a raw memory access tried to access part of a pointer value as raw bytes
error: aborting due to 2 previous errors
I haven't looked at the MIR, but it's strange that a raw pointer -> usize cast is going on here?