Skip to content

Commit

Permalink
Fix smir's Ty::Ref pretty printing
Browse files Browse the repository at this point in the history
  • Loading branch information
celinval committed Nov 25, 2023
1 parent 42ae1a7 commit 60817e6
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions compiler/stable_mir/src/mir/pretty.rs
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,6 @@ pub fn pretty_rvalue(rval: &Rvalue) -> String {

pub fn pretty_ty(ty: TyKind) -> String {
let mut pretty = String::new();
pretty.push_str("");
match ty {
TyKind::RigidTy(rigid_ty) => match rigid_ty {
RigidTy::Bool => "bool".to_string(),
Expand Down Expand Up @@ -215,7 +214,10 @@ pub fn pretty_ty(ty: TyKind) -> String {
pretty.push_str(&pretty_ty(ty.kind()));
pretty
}
RigidTy::Ref(_, ty, _) => pretty_ty(ty.kind()),
RigidTy::Ref(_, ty, mutability) => match mutability {
Mutability::Not => format!("&{}", pretty_ty(ty.kind())),
Mutability::Mut => format!("&mut {}", pretty_ty(ty.kind())),
},
RigidTy::FnDef(_, _) => format!("{:#?}", rigid_ty),
RigidTy::FnPtr(_) => format!("{:#?}", rigid_ty),
RigidTy::Closure(_, _) => format!("{:#?}", rigid_ty),
Expand Down

0 comments on commit 60817e6

Please sign in to comment.