forked from rustwasm/wasm-bindgen
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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 rustwasm#1528 but now it can be, and one is include (although the error message is quite bad).
- Loading branch information
1 parent
f23b867
commit a02d210
Showing
3 changed files
with
41 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
use wasm_bindgen::prelude::*; | ||
|
||
#[wasm_bindgen] | ||
extern "C" { | ||
#[wasm_bindgen] | ||
pub fn foo() -> Result<JsValue, JsValue>; | ||
} | ||
|
||
fn main() {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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`. |