Make the trap name for unreachable traps more descriptive. (#3568)

Following up on WebAssembly/wasi-sdk#210, this makes the trap message
for `unreachable` traps more descriptive of what actually caused the
trap, so that it doesn't sound like maybe Wasmtime itself executed a
`unreachable!()` macro in Rust.

Before:
```
wasm trap: unreachable
wasm backtrace:
     [...]
```

After:
```
wasm trap: wasm `unreachable` instruction executed
wasm backtrace:
     [...]
```
This commit is contained in:
Dan Gohman
2021-11-29 15:55:10 -08:00
committed by GitHub
parent b1a40646e3
commit 42b23dac4a
2 changed files with 6 additions and 6 deletions

View File

@@ -119,7 +119,7 @@ impl fmt::Display for TrapCode {
IntegerOverflow => "integer overflow",
IntegerDivisionByZero => "integer divide by zero",
BadConversionToInteger => "invalid conversion to integer",
UnreachableCodeReached => "unreachable",
UnreachableCodeReached => "wasm `unreachable` instruction executed",
Interrupt => "interrupt",
};
write!(f, "{}", desc)