mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-25 08:13:41 +00:00
Simplify based on eddyb's comment
This commit is contained in:
parent
0bf75fbfc8
commit
4a48d680f2
@ -55,28 +55,16 @@ 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, &[])
|
||||
.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 {
|
||||
|
Loading…
Reference in New Issue
Block a user