Rust enums with discriminators greater than u64::MAX are not encoded properly because LLVM lacks the appropriate APIs to do so. As a result, we assert!() in some situations:
|
// NOTE(eddyb) do *NOT* remove this assert, until |
|
// we pass the full 128-bit value to LLVM, otherwise |
|
// truncation will be silent and remain undetected. |
|
assert_eq!(value as u64 as u128, value); |
#![feature(repr128)]
#[repr(u128)]
pub enum Foo {
Lo,
Hi = 1 << 64,
Bar = 18_446_745_000_000_000_123,
}
pub fn foo() -> Option<Foo> {
None
}
To fix this, we need APIs in LLVM to pass the correct value and have it be encoded in the DWARF.
Split off of #59509
Rust enums with discriminators greater than
u64::MAXare not encoded properly because LLVM lacks the appropriate APIs to do so. As a result, weassert!()in some situations:rust/compiler/rustc_codegen_llvm/src/debuginfo/metadata/enums/native.rs
Lines 416 to 419 in 8006510
To fix this, we need APIs in LLVM to pass the correct value and have it be encoded in the DWARF.
Split off of #59509