Use tcx.symbol_name

This commit is contained in:
bjorn3 2018-08-11 14:29:32 +02:00
parent 39cc4fd3fc
commit af69258971
2 changed files with 2 additions and 13 deletions

View File

@ -160,11 +160,7 @@ pub fn get_function_name_and_sig<'a, 'tcx>(
assert!(!inst.substs.needs_infer() && !inst.substs.has_param_types());
let fn_ty = inst.ty(tcx);
let sig = cton_sig_from_fn_ty(tcx, fn_ty);
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);
(name, sig)
(tcx.symbol_name(inst).as_str().to_string(), sig)
}
impl<'a, 'tcx: 'a> CodegenCx<'a, 'tcx, CurrentBackend> {

View File

@ -11,7 +11,7 @@ pub fn trans_mono_item<'a, 'tcx: 'a>(
MonoItem::Fn(inst) => match inst {
Instance {
def: InstanceDef::Item(def_id),
substs,
substs: _,
} => {
let mut mir = ::std::io::Cursor::new(Vec::new());
::rustc_mir::util::write_mir_pretty(tcx, Some(def_id), &mut mir).unwrap();
@ -21,13 +21,6 @@ pub fn trans_mono_item<'a, 'tcx: 'a>(
String::from_utf8_lossy(&mir.into_inner())
));
let fn_ty = inst.ty(tcx);
let fn_ty = tcx.subst_and_normalize_erasing_regions(
substs,
ty::ParamEnv::reveal_all(),
&fn_ty,
);
let (func_id, mut func) = cx.predefine_function(inst);
let comments = trans_fn(cx, &mut func, inst);