mirror of
https://github.com/rust-lang/rust.git
synced 2025-06-05 19:58:32 +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());
|
assert!(!inst.substs.needs_infer() && !inst.substs.has_param_types());
|
||||||
let fn_ty = inst.ty(tcx);
|
let fn_ty = inst.ty(tcx);
|
||||||
let sig = cton_sig_from_fn_ty(tcx, fn_ty);
|
let sig = cton_sig_from_fn_ty(tcx, fn_ty);
|
||||||
let def_path_based_names =
|
(tcx.symbol_name(inst).as_str().to_string(), sig)
|
||||||
::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)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a, 'tcx: 'a> CodegenCx<'a, 'tcx, CurrentBackend> {
|
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 {
|
MonoItem::Fn(inst) => match inst {
|
||||||
Instance {
|
Instance {
|
||||||
def: InstanceDef::Item(def_id),
|
def: InstanceDef::Item(def_id),
|
||||||
substs,
|
substs: _,
|
||||||
} => {
|
} => {
|
||||||
let mut mir = ::std::io::Cursor::new(Vec::new());
|
let mut mir = ::std::io::Cursor::new(Vec::new());
|
||||||
::rustc_mir::util::write_mir_pretty(tcx, Some(def_id), &mut mir).unwrap();
|
::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())
|
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 (func_id, mut func) = cx.predefine_function(inst);
|
||||||
|
|
||||||
let comments = trans_fn(cx, &mut func, inst);
|
let comments = trans_fn(cx, &mut func, inst);
|
||||||
|
Loading…
Reference in New Issue
Block a user