Skip to content

Commit

Permalink
Use better symbol names for the drop glue
Browse files Browse the repository at this point in the history
  • Loading branch information
bjorn3 committed Dec 12, 2020
1 parent 3f2088a commit 0bf75fb
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions compiler/rustc_symbol_mangling/src/legacy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,26 @@ pub(super) fn mangle(

let hash = get_symbol_hash(tcx, instance, instance_ty, instantiating_crate);

if let ty::InstanceDef::DropGlue(_drop_in_place, ty) = instance.def {
// Use `{{drop}}::<$TYPE>::$hash` as name for the drop glue instead of
// `core::mem::drop_in_place::$hash`.
let mut printer =
SymbolPrinter { tcx, path: SymbolPath::new(), keep_within_component: false };
printer.write_str("{{drop}}").unwrap();
printer.path.finalize_pending_component();
let printer = printer
.generic_delimiters(|mut printer| {
if let Some(ty) = ty {
printer.print_type(ty)
} else {
printer.write_str("_")?;
Ok(printer)
}
})
.unwrap();
return printer.path.finish(hash);
}

let mut printer = SymbolPrinter { tcx, path: SymbolPath::new(), keep_within_component: false }
.print_def_path(def_id, &[])
.unwrap();
Expand Down

0 comments on commit 0bf75fb

Please sign in to comment.