|
1 | 1 | use crate::mir::{Operand, Rvalue, StatementKind}; |
2 | 2 | use crate::ty::{DynKind, FloatTy, IntTy, RigidTy, TyKind, UintTy}; |
3 | | -use crate::{Body, CrateItem, Mutability}; |
| 3 | +use crate::{with, Body, CrateItem, Mutability}; |
4 | 4 |
|
5 | 5 | pub fn function_name(item: CrateItem) -> String { |
6 | 6 | let mut pretty_name = String::new(); |
@@ -80,10 +80,9 @@ pub fn pretty_operand(operand: &Operand) -> String { |
80 | 80 | pretty.push_str("move "); |
81 | 81 | pretty.push_str(format!("_{}", mv.local).as_str()); |
82 | 82 | } |
83 | | - Operand::Constant(_) => { |
84 | | - // FIXME: Once https://github.com/rust-lang/rust/pull/117688 we will have ability to replace this |
| 83 | + Operand::Constant(cnst) => { |
85 | 84 | pretty.push_str("const "); |
86 | | - //pretty.push_str(internal(&cnst.literal).to_string().as_str()); |
| 85 | + pretty.push_str(with(|cx| cx.const_literal(&cnst.literal)).as_str()); |
87 | 86 | } |
88 | 87 | } |
89 | 88 | pretty |
@@ -196,14 +195,12 @@ pub fn pretty_ty(ty: TyKind) -> String { |
196 | 195 | FloatTy::F32 => "f32".to_string(), |
197 | 196 | FloatTy::F64 => "f64".to_string(), |
198 | 197 | }, |
199 | | - RigidTy::Adt(_, _) => { |
200 | | - // FIXME: Once https://github.com/rust-lang/rust/pull/117688 we will have ability to replace this |
201 | | - format!("{rigid_ty:#?}") |
| 198 | + RigidTy::Adt(def, _) => { |
| 199 | + format!("{:#?}", with(|cx| cx.def_ty(def.0))) |
202 | 200 | } |
203 | 201 | RigidTy::Str => "str".to_string(), |
204 | 202 | RigidTy::Array(ty, len) => { |
205 | | - // FIXME: Once https://github.com/rust-lang/rust/pull/117688 we will have ability to replace this |
206 | | - format!("[{}; {:#?}]", pretty_ty(ty.kind()), len) |
| 203 | + format!("[{}; {}]", pretty_ty(ty.kind()), with(|cx| cx.const_literal(&len))) |
207 | 204 | } |
208 | 205 | RigidTy::Slice(ty) => { |
209 | 206 | format!("[{}]", pretty_ty(ty.kind())) |
|
0 commit comments