diff options
| author | bjorn3 <bjorn3@users.noreply.github.com> | 2020-12-12 16:51:11 +0100 |
|---|---|---|
| committer | bjorn3 <bjorn3@users.noreply.github.com> | 2020-12-12 18:28:08 +0100 |
| commit | 0bf75fbfc8812ed0c7dc827def29c9d65a438eac (patch) | |
| tree | 066f561c1087a76015610c82164f123a6a54f98e | |
| parent | 3f2088aa603d2cd3f43c20795872de9cd6ec7735 (diff) | |
| download | rust-0bf75fbfc8812ed0c7dc827def29c9d65a438eac.tar.gz rust-0bf75fbfc8812ed0c7dc827def29c9d65a438eac.zip | |
Use better symbol names for the drop glue
| -rw-r--r-- | compiler/rustc_symbol_mangling/src/legacy.rs | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/compiler/rustc_symbol_mangling/src/legacy.rs b/compiler/rustc_symbol_mangling/src/legacy.rs index eba8e1a0613..60b60db6493 100644 --- a/compiler/rustc_symbol_mangling/src/legacy.rs +++ b/compiler/rustc_symbol_mangling/src/legacy.rs @@ -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(); |
