mirror of
https://github.com/fluencelabs/wasm-bindgen
synced 2025-06-12 20:41:24 +00:00
Catch more errors on non-wasm32 platforms
This commit tweaks the codegen for imported functions and such (anything that relies on some imported intrinsic or function filled in by the CLI) to share as much code as possible on non-wasm32 platforms. This should help us catch more errors before compiling to wasm and also just make it easier to write UI tests! For example a UI test previously couldn't be written for #1528 but now it can be, and one is include (although the error message is quite bad).
This commit is contained in:
9
crates/macro/ui-tests/missing-catch.rs
Normal file
9
crates/macro/ui-tests/missing-catch.rs
Normal file
@ -0,0 +1,9 @@
|
||||
use wasm_bindgen::prelude::*;
|
||||
|
||||
#[wasm_bindgen]
|
||||
extern "C" {
|
||||
#[wasm_bindgen]
|
||||
pub fn foo() -> Result<JsValue, JsValue>;
|
||||
}
|
||||
|
||||
fn main() {}
|
7
crates/macro/ui-tests/missing-catch.stderr
Normal file
7
crates/macro/ui-tests/missing-catch.stderr
Normal file
@ -0,0 +1,7 @@
|
||||
error[E0277]: the trait bound `std::result::Result<wasm_bindgen::JsValue, wasm_bindgen::JsValue>: wasm_bindgen::convert::traits::FromWasmAbi` is not satisfied
|
||||
--> $DIR/missing-catch.rs:3:1
|
||||
|
|
||||
3 | #[wasm_bindgen]
|
||||
| ^^^^^^^^^^^^^^^ the trait `wasm_bindgen::convert::traits::FromWasmAbi` is not implemented for `std::result::Result<wasm_bindgen::JsValue, wasm_bindgen::JsValue>`
|
||||
|
||||
For more information about this error, try `rustc --explain E0277`.
|
Reference in New Issue
Block a user