diff --git a/src/base.rs b/src/base.rs index 27e3506ece3..8c19aba1404 100644 --- a/src/base.rs +++ b/src/base.rs @@ -14,7 +14,10 @@ pub fn trans_mono_item<'a, 'tcx: 'a>(cx: &mut CodegenCx<'a, 'tcx, CurrentBackend let func_id = { let module = &mut cx.module; *cx.def_id_fn_id_map.entry(inst).or_insert_with(|| { - module.declare_function(&tcx.absolute_item_path_str(def_id), Linkage::Local, &sig).unwrap() + let def_path_based_names = ::rustc_mir::monomorphize::item::DefPathBasedNames::new(tcx, false, false); + let mut name = String::new(); + def_path_based_names.push_instance_as_string(inst, &mut name); + module.declare_function(&name, Linkage::Local, &sig).unwrap() }) };