mirror of
https://github.com/rust-lang/rust.git
synced 2025-05-14 02:49:40 +00:00
Use tcx.symbol_name
This commit is contained in:
parent
39cc4fd3fc
commit
af69258971
@ -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> {
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user