wiggle: make wasmtime a mandatory dep, get rid of own Trap enum (#5137)
* wiggle: no longer need to guard wasmtime integration behind a feature this existed so we could use wiggle in lucet, but lucet is long EOL * replace wiggle::Trap with wiggle::wasmtime_crate::Trap * wiggle tests: unwrap traps because we cant assert_eq on them * wasi-common: emit a wasmtime::Trap instead of a wiggle::Trap formally add a dependency on wasmtime here to make it obvious, though we do now have a transitive one via wiggle no matter what (and therefore can get rid of the default-features=false on the wiggle dep) * wasi-nn: use wasmtime::Trap instead of wiggle::Trap there's no way the implementation of this func is actually a good idea, it will panic the host process on any error, but I'll ask @mtr to fix that * wiggle test-helpers examples: fixes * wasi-common cant cross compile to wasm32-unknown-emscripten anymore this was originally for the WASI polyfill for web targets. Those days are way behind us now. * wasmtime wont compile for armv7-unknown-linux-gnueabihf either
This commit is contained in:
@@ -28,10 +28,10 @@ impl wiggle::GuestErrorType for types::Errno {
|
||||
}
|
||||
|
||||
impl types::UserErrorConversion for WasiCtx {
|
||||
fn errno_from_error(&mut self, e: Error) -> Result<types::Errno, wiggle::Trap> {
|
||||
fn errno_from_error(&mut self, e: Error) -> Result<types::Errno, wasmtime::Trap> {
|
||||
debug!("Error: {:?}", e);
|
||||
e.try_into()
|
||||
.map_err(|e| wiggle::Trap::String(format!("{:?}", e)))
|
||||
.map_err(|e| wasmtime::Trap::new(format!("{:?}", e)))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -932,7 +932,7 @@ impl wasi_unstable::WasiUnstable for WasiCtx {
|
||||
Ok(num_results.try_into().expect("results fit into memory"))
|
||||
}
|
||||
|
||||
async fn proc_exit(&mut self, status: types::Exitcode) -> wiggle::Trap {
|
||||
async fn proc_exit(&mut self, status: types::Exitcode) -> wasmtime::Trap {
|
||||
Snapshot1::proc_exit(self, status).await
|
||||
}
|
||||
|
||||
|
||||
@@ -35,10 +35,10 @@ impl wiggle::GuestErrorType for types::Errno {
|
||||
}
|
||||
|
||||
impl types::UserErrorConversion for WasiCtx {
|
||||
fn errno_from_error(&mut self, e: Error) -> Result<types::Errno, wiggle::Trap> {
|
||||
fn errno_from_error(&mut self, e: Error) -> Result<types::Errno, wasmtime::Trap> {
|
||||
debug!("Error: {:?}", e);
|
||||
e.try_into()
|
||||
.map_err(|e| wiggle::Trap::String(format!("{:?}", e)))
|
||||
.map_err(|e| wasmtime::Trap::new(format!("{:?}", e)))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1214,12 +1214,12 @@ impl wasi_snapshot_preview1::WasiSnapshotPreview1 for WasiCtx {
|
||||
Ok(num_results.try_into().expect("results fit into memory"))
|
||||
}
|
||||
|
||||
async fn proc_exit(&mut self, status: types::Exitcode) -> wiggle::Trap {
|
||||
async fn proc_exit(&mut self, status: types::Exitcode) -> wasmtime::Trap {
|
||||
// Check that the status is within WASI's range.
|
||||
if status < 126 {
|
||||
wiggle::Trap::I32Exit(status as i32)
|
||||
wasmtime::Trap::i32_exit(status as i32)
|
||||
} else {
|
||||
wiggle::Trap::String("exit with invalid exit status outside of [0..126)".to_owned())
|
||||
wasmtime::Trap::new("exit with invalid exit status outside of [0..126)")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user