-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Closed
Copy link
Labels
A-debuginfoArea: Debugging information in compiled programs (DWARF, PDB, etc.)Area: Debugging information in compiled programs (DWARF, PDB, etc.)A-layoutArea: Memory layout of typesArea: Memory layout of typesC-bugCategory: This is a bug.Category: This is a bug.O-windows-msvcToolchain: MSVC, Operating system: WindowsToolchain: MSVC, Operating system: Windows
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.
Metadata
Metadata
Assignees
Labels
A-debuginfoArea: Debugging information in compiled programs (DWARF, PDB, etc.)Area: Debugging information in compiled programs (DWARF, PDB, etc.)A-layoutArea: Memory layout of typesArea: Memory layout of typesC-bugCategory: This is a bug.Category: This is a bug.O-windows-msvcToolchain: MSVC, Operating system: WindowsToolchain: MSVC, Operating system: Windows