Skip to content

Commit

Permalink
Cranelift: Provide better error messages when failing to parse run
Browse files Browse the repository at this point in the history
…arguments (bytecodealliance#6644)
  • Loading branch information
fitzgen authored Jun 26, 2023
1 parent 2d34b46 commit 4c23880
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion cranelift/reader/src/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,11 @@ macro_rules! match_imm {
let text = text.replace("_", "");
// Parse it in hexadecimal form.
<$unsigned>::from_str_radix(&text[2..], 16).map_err(|_| {
$parser.error("unable to parse value as a hexadecimal immediate")
$parser.error(&format!(
"unable to parse '{}' value as a hexadecimal {} immediate",
&text[2..],
stringify!($unsigned),
))
})?
} else {
// Parse it as a signed type to check for overflow and other issues.
Expand Down

0 comments on commit 4c23880

Please sign in to comment.