Fix uninlined_format_args in stable_mir
This commit is contained in:
parent
88f311479d
commit
d3d59055a9
@ -22,7 +22,7 @@ impl Debug for Place {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn function_body<W: Write>(writer: &mut W, body: &Body, name: &str) -> io::Result<()> {
|
pub(crate) fn function_body<W: Write>(writer: &mut W, body: &Body, name: &str) -> io::Result<()> {
|
||||||
write!(writer, "fn {}(", name)?;
|
write!(writer, "fn {name}(")?;
|
||||||
body.arg_locals()
|
body.arg_locals()
|
||||||
.iter()
|
.iter()
|
||||||
.enumerate()
|
.enumerate()
|
||||||
@ -54,7 +54,7 @@ pub(crate) fn function_body<W: Write>(writer: &mut W, body: &Body, name: &str) -
|
|||||||
.iter()
|
.iter()
|
||||||
.enumerate()
|
.enumerate()
|
||||||
.map(|(index, block)| -> io::Result<()> {
|
.map(|(index, block)| -> io::Result<()> {
|
||||||
writeln!(writer, " bb{}: {{", index)?;
|
writeln!(writer, " bb{index}: {{")?;
|
||||||
let _ = block
|
let _ = block
|
||||||
.statements
|
.statements
|
||||||
.iter()
|
.iter()
|
||||||
@ -75,7 +75,7 @@ pub(crate) fn function_body<W: Write>(writer: &mut W, body: &Body, name: &str) -
|
|||||||
fn pretty_statement<W: Write>(writer: &mut W, statement: &StatementKind) -> io::Result<()> {
|
fn pretty_statement<W: Write>(writer: &mut W, statement: &StatementKind) -> io::Result<()> {
|
||||||
match statement {
|
match statement {
|
||||||
StatementKind::Assign(place, rval) => {
|
StatementKind::Assign(place, rval) => {
|
||||||
write!(writer, " {:?} = ", place)?;
|
write!(writer, " {place:?} = ")?;
|
||||||
pretty_rvalue(writer, rval)?;
|
pretty_rvalue(writer, rval)?;
|
||||||
writeln!(writer, ";")
|
writeln!(writer, ";")
|
||||||
}
|
}
|
||||||
@ -165,7 +165,7 @@ fn pretty_terminator_head<W: Write>(writer: &mut W, terminator: &TerminatorKind)
|
|||||||
Abort => write!(writer, "{INDENT}abort"),
|
Abort => write!(writer, "{INDENT}abort"),
|
||||||
Return => write!(writer, "{INDENT}return"),
|
Return => write!(writer, "{INDENT}return"),
|
||||||
Unreachable => write!(writer, "{INDENT}unreachable"),
|
Unreachable => write!(writer, "{INDENT}unreachable"),
|
||||||
Drop { place, .. } => write!(writer, "{INDENT}drop({:?})", place),
|
Drop { place, .. } => write!(writer, "{INDENT}drop({place:?})"),
|
||||||
Call { func, args, destination, .. } => {
|
Call { func, args, destination, .. } => {
|
||||||
write!(writer, "{INDENT}{:?} = {}(", destination, pretty_operand(func))?;
|
write!(writer, "{INDENT}{:?} = {}(", destination, pretty_operand(func))?;
|
||||||
let mut args_iter = args.iter();
|
let mut args_iter = args.iter();
|
||||||
@ -304,10 +304,10 @@ fn pretty_assert_message<W: Write>(writer: &mut W, msg: &AssertMessage) -> io::R
|
|||||||
fn pretty_operand(operand: &Operand) -> String {
|
fn pretty_operand(operand: &Operand) -> String {
|
||||||
match operand {
|
match operand {
|
||||||
Operand::Copy(copy) => {
|
Operand::Copy(copy) => {
|
||||||
format!("{:?}", copy)
|
format!("{copy:?}")
|
||||||
}
|
}
|
||||||
Operand::Move(mv) => {
|
Operand::Move(mv) => {
|
||||||
format!("move {:?}", mv)
|
format!("move {mv:?}")
|
||||||
}
|
}
|
||||||
Operand::Constant(cnst) => pretty_mir_const(&cnst.const_),
|
Operand::Constant(cnst) => pretty_mir_const(&cnst.const_),
|
||||||
}
|
}
|
||||||
@ -344,13 +344,13 @@ fn pretty_rvalue<W: Write>(writer: &mut W, rval: &Rvalue) -> io::Result<()> {
|
|||||||
write!(writer, "Checked{:?}({}, {})", bin, pretty_operand(op1), pretty_operand(op2))
|
write!(writer, "Checked{:?}({}, {})", bin, pretty_operand(op1), pretty_operand(op2))
|
||||||
}
|
}
|
||||||
Rvalue::CopyForDeref(deref) => {
|
Rvalue::CopyForDeref(deref) => {
|
||||||
write!(writer, "CopyForDeref({:?})", deref)
|
write!(writer, "CopyForDeref({deref:?})")
|
||||||
}
|
}
|
||||||
Rvalue::Discriminant(place) => {
|
Rvalue::Discriminant(place) => {
|
||||||
write!(writer, "discriminant({:?})", place)
|
write!(writer, "discriminant({place:?})")
|
||||||
}
|
}
|
||||||
Rvalue::Len(len) => {
|
Rvalue::Len(len) => {
|
||||||
write!(writer, "len({:?})", len)
|
write!(writer, "len({len:?})")
|
||||||
}
|
}
|
||||||
Rvalue::Ref(_, borrowkind, place) => {
|
Rvalue::Ref(_, borrowkind, place) => {
|
||||||
let kind = match borrowkind {
|
let kind = match borrowkind {
|
||||||
@ -359,17 +359,17 @@ fn pretty_rvalue<W: Write>(writer: &mut W, rval: &Rvalue) -> io::Result<()> {
|
|||||||
BorrowKind::Fake(FakeBorrowKind::Shallow) => "&fake shallow ",
|
BorrowKind::Fake(FakeBorrowKind::Shallow) => "&fake shallow ",
|
||||||
BorrowKind::Mut { .. } => "&mut ",
|
BorrowKind::Mut { .. } => "&mut ",
|
||||||
};
|
};
|
||||||
write!(writer, "{kind}{:?}", place)
|
write!(writer, "{kind}{place:?}")
|
||||||
}
|
}
|
||||||
Rvalue::Repeat(op, cnst) => {
|
Rvalue::Repeat(op, cnst) => {
|
||||||
write!(writer, "{} \" \" {}", pretty_operand(op), pretty_ty_const(cnst))
|
write!(writer, "{} \" \" {}", pretty_operand(op), pretty_ty_const(cnst))
|
||||||
}
|
}
|
||||||
Rvalue::ShallowInitBox(_, _) => Ok(()),
|
Rvalue::ShallowInitBox(_, _) => Ok(()),
|
||||||
Rvalue::ThreadLocalRef(item) => {
|
Rvalue::ThreadLocalRef(item) => {
|
||||||
write!(writer, "thread_local_ref{:?}", item)
|
write!(writer, "thread_local_ref{item:?}")
|
||||||
}
|
}
|
||||||
Rvalue::NullaryOp(nul, ty) => {
|
Rvalue::NullaryOp(nul, ty) => {
|
||||||
write!(writer, "{:?} {} \" \"", nul, ty)
|
write!(writer, "{nul:?} {ty} \" \"")
|
||||||
}
|
}
|
||||||
Rvalue::UnaryOp(un, op) => {
|
Rvalue::UnaryOp(un, op) => {
|
||||||
write!(writer, "{} \" \" {:?}", pretty_operand(op), un)
|
write!(writer, "{} \" \" {:?}", pretty_operand(op), un)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user