mirror of
https://github.com/fluencelabs/wasmer
synced 2025-06-20 20:26:32 +00:00
doc(runtime-c-api) Explain why code is unreachable in wasmer_trap
.
This commit is contained in:
@ -725,6 +725,12 @@ pub unsafe extern "C" fn wasmer_trap(
|
||||
.runnable_module
|
||||
.do_early_trap(Box::new(error_message)); // never returns
|
||||
|
||||
// cbindgen does not generate a binding for a function that
|
||||
// returns `!`. Since we also need to error in some cases, the
|
||||
// output type of `wasmer_trap` is `wasmer_result_t`. But the OK
|
||||
// case is not reachable because `do_early_trap` never
|
||||
// returns. That's a compromise to satisfy the Rust type system,
|
||||
// cbindgen, and get an acceptable clean code.
|
||||
#[allow(unreachable_code)]
|
||||
wasmer_result_t::WASMER_OK
|
||||
}
|
||||
|
Reference in New Issue
Block a user