Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use global paths / #[wasm_bindgen] could not find ops in core #3964

Open
G-M0N3Y-2503 opened this issue May 18, 2024 · 0 comments
Open

use global paths / #[wasm_bindgen] could not find ops in core #3964

G-M0N3Y-2503 opened this issue May 18, 2024 · 0 comments
Labels

Comments

@G-M0N3Y-2503
Copy link

Describe the Bug

Using #[wasm_bindgen] in a crate named core fails to generate a Deref impl for an imported Javascript type.

Steps to Reproduce

Compile the following crate named core

//! core.rs

#[wasm_bindgen]
extern "C" {
    type ImportedJsType;
}

Expected Behavior

The global path core in the extern prelude is used so that it doesn't conflict with the local crate.

Actual Behavior

error[E0433]: failed to resolve: could not find `ops` in `core`
  --> src/actions_toolkit/core.rs:41:1
   |
41 | #[wasm_bindgen]
   | ^^^^^^^^^^^^^^^ could not find `ops` in `core`
   |
   = note: this error originates in the attribute macro `wasm_bindgen` (in Nightly builds, run with -Z macro-backtrace for more info)
help: consider importing one of these items
   |
1  + use ::core::ops;
   |
1  + use std::ops;
   |

Additional Context

Workarounds

//! core.rs

#[wasm_bindgen]
extern "C" {
    #[wasm_bindgen(no_deref)]
    type ImportedJsType;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant