Rollup merge of #79968 - bjorn3:better_drop_glue_debuginfo, r=matthewjasper

Improve core::ptr::drop_in_place debuginfo

* Use span of the dropped type as function span when possible.
* Rename symbol from `core::ptr::drop_in_place::$hash` to `{{drop}}::<$TYPE>::$hash`.

Fixes #77465

(I haven't yet updated the tests)
This commit is contained in:
Yuki Okushi 2021-01-10 16:55:55 +09:00 committed by GitHub
commit f90c7f0f42
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -56,7 +56,15 @@ pub(super) fn mangle(
let hash = get_symbol_hash(tcx, instance, instance_ty, instantiating_crate);
let mut printer = SymbolPrinter { tcx, path: SymbolPath::new(), keep_within_component: false }
.print_def_path(def_id, &[])
.print_def_path(
def_id,
if let ty::InstanceDef::DropGlue(_, _) = instance.def {
// Add the name of the dropped type to the symbol name
&*instance.substs
} else {
&[]
},
)
.unwrap();
if let ty::InstanceDef::VtableShim(..) = instance.def {