Use DefPathBasedNames

This commit is contained in:
bjorn3 2018-06-30 18:22:20 +02:00
parent 24e2eb25d4
commit 4beb931641

View File

@ -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()
})
};