Skip to content

Commit

Permalink
Fix resolution of wasm_bindgen in js! macro
Browse files Browse the repository at this point in the history
This fixes an issue that, when a dependent crate depends on `stdweb` for
the use of the `js!` macro but does not specify the dependency
`wasm_bindgen`, attempting to build for the target
`wasm32-unknown-unknown` (or using `wasm-pack` and friends) will yield
the following error:

    error[E0433]: failed to resolve: use of undeclared type or module
    `wasm_bindgen`
  • Loading branch information
alvinhochun committed Feb 24, 2020
1 parent 9b418d9 commit f492a45
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions stdweb-internal-macros/src/js_shim.rs
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ pub fn js_shim_extern_code( target: Target, code: &str, arg_count: usize, return
let shim_name = &shim_name;
let shim_args = &shim_args;
quote! {
use ::stdweb::private::wasm_bindgen;
use ::stdweb::private::wasm_bindgen::prelude::*;
unsafe fn #shim_name( #(#shim_args),* ) #return_signature {
#[wasm_bindgen(inline_js = #code_string)]
Expand Down

0 comments on commit f492a45

Please sign in to comment.