You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Recently, I started seeing an error message during compilation on a simple enum with the #[wasm_bingen] attribute macro. The significant detail about the macro is that it includes a variant named Error.
Here's the compilation error message:
error: ambiguous associated item
--> tests/wasm/enums.rs:74:1
|
74 | #[wasm_bindgen]
| ^^^^^^^^^^^^^^^
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #57644 <https://github.com/rust-lang/rust/issues/57644>
note: `Error` could refer to the variant defined here
--> tests/wasm/enums.rs:79:5
|
79 | Error,
| ^^^^^
note: `Error` could also refer to the associated type defined here
--> /Users/someuser/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/src/rust/library/core/src/convert/mod.rs:641:5
|
641 | type Error;
| ^^^^^^^^^^
= note: `#[deny(ambiguous_associated_items)]` on by default
= note: this error originates in the attribute macro `wasm_bindgen` (in Nightly builds, run with -Z macro-backtrace for more info)
Describe the Bug
Recently, I started seeing an error message during compilation on a simple enum with the
#[wasm_bingen]
attribute macro. The significant detail about the macro is that it includes a variant namedError
.Here's the compilation error message:
Steps to Reproduce
Expected Behavior
Compilation with no errors
Actual Behavior
Compilation error
Prototype
I found that the compilation error was eliminated when changing this codegen:
To this:
Notice the Error type in the return
Result
is<EnumWithErrorVariant as TryFrom<JsValue>>::Error
instead ofSelf::Error
This based on the guidance indicated by the rust issue linked in the error message:
rust-lang/rust#57644
The text was updated successfully, but these errors were encountered: