Closed
Description
Niche layout enum variants do not get distinct type names that include type parameters which can cause duplicate type names for variants like Option::Some
. This in turn will causes debugger to randomly pick one of the various type layouts when inspecting values which can cause invalid results.
fn main() {
let a = Some(&1u8);
let b = Some(&2u16);
let c = Some(&3u32);
let d = Some(&4u64);
let e = Some(&5i8);
let f = Some(&6i64);
std::process::exit(0); // bp here
}
Notice the values for a
, b
and c
are totally wrong because they are using the layout for Option<&i64>::Some
. The types for the other variables are also wrong but that doesn't happen to cause issues in this particular instance.