Bug
In compiler/rustc_codegen_cranelift/src/debuginfo/types.rs:133, the pointer_type() method checks whether the pointer type itself has metadata, instead of checking whether the pointee type has metadata:
fn pointer_type(..., ptr_type: Ty, pointee_type: Ty) -> UnitEntryId {
// ...
if !tcx.type_has_metadata(ptr_type, ...) { // BUG: should be pointee_type
type_has_metadata on a pointer type (*const dyn Trait, &[u8]) always returns false because the pointer itself is a concrete sized type. The pointee (dyn Trait, [u8]) is what determines whether the pointer is wide (needs metadata).
This makes ALL pointers appear thin in DWARF debuginfo, causing debuggers to miss the vtable/length component of wide pointers.
Fix
Change ptr_type to pointee_type in the type_has_metadata call.
Impact
All wide pointers (&dyn Trait, &[T], *const dyn Trait, etc.) get incorrect DWARF debuginfo under the Cranelift backend, showing as thin pointers missing their metadata.
Bug
In
compiler/rustc_codegen_cranelift/src/debuginfo/types.rs:133, thepointer_type()method checks whether the pointer type itself has metadata, instead of checking whether the pointee type has metadata:type_has_metadataon a pointer type (*const dyn Trait,&[u8]) always returns false because the pointer itself is a concrete sized type. The pointee (dyn Trait,[u8]) is what determines whether the pointer is wide (needs metadata).This makes ALL pointers appear thin in DWARF debuginfo, causing debuggers to miss the vtable/length component of wide pointers.
Fix
Change
ptr_typetopointee_typein thetype_has_metadatacall.Impact
All wide pointers (
&dyn Trait,&[T],*const dyn Trait, etc.) get incorrect DWARF debuginfo under the Cranelift backend, showing as thin pointers missing their metadata.