Prefix verifier errors with ; (#585)
* Prefix verifier errors with ; extract arrow drawing code into helper print ; at beginning of line followed by arrow and error body
This commit is contained in:
@@ -84,11 +84,7 @@ fn pretty_instruction_error(
|
|||||||
printed_instr = true;
|
printed_instr = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
write!(w, "{1:0$}^", indent, "")?;
|
print_error(w, indent, cur_inst.to_string(), err)?;
|
||||||
for _c in cur_inst.to_string().chars() {
|
|
||||||
write!(w, "~")?;
|
|
||||||
}
|
|
||||||
writeln!(w, " verifier {}", err.to_string())?;
|
|
||||||
}
|
}
|
||||||
ir::entities::AnyEntity::Inst(_) => i += 1,
|
ir::entities::AnyEntity::Inst(_) => i += 1,
|
||||||
_ => unreachable!(),
|
_ => unreachable!(),
|
||||||
@@ -133,11 +129,7 @@ fn pretty_preamble_error(
|
|||||||
printed_entity = true;
|
printed_entity = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
write!(w, "{1:0$}^", indent, "")?;
|
print_error(w, indent, entity.to_string(), err)?;
|
||||||
for _c in entity.to_string().chars() {
|
|
||||||
write!(w, "~")?;
|
|
||||||
}
|
|
||||||
writeln!(w, " verifier {}", err.to_string())?;
|
|
||||||
} else {
|
} else {
|
||||||
i += 1
|
i += 1
|
||||||
}
|
}
|
||||||
@@ -152,6 +144,18 @@ fn pretty_preamble_error(
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Prints ; ^~~~~~ verifier [ERROR BODY]
|
||||||
|
fn print_error(w: &mut Write, indent: usize, s: String, err: VerifierError) -> fmt::Result {
|
||||||
|
let indent = if indent < 1 { 0 } else { indent - 1 };
|
||||||
|
|
||||||
|
write!(w, ";{1:0$}^", indent, "")?;
|
||||||
|
for _c in s.chars() {
|
||||||
|
write!(w, "~")?;
|
||||||
|
}
|
||||||
|
writeln!(w, " verifier {}", err.to_string())?;
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
/// Pretty-print a Cranelift error.
|
/// Pretty-print a Cranelift error.
|
||||||
pub fn pretty_error(func: &ir::Function, isa: Option<&TargetIsa>, err: CodegenError) -> String {
|
pub fn pretty_error(func: &ir::Function, isa: Option<&TargetIsa>, err: CodegenError) -> String {
|
||||||
if let CodegenError::Verifier(e) = err {
|
if let CodegenError::Verifier(e) = err {
|
||||||
|
|||||||
Reference in New Issue
Block a user