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
I'm able to apply conditionally wasm_bindgen proc-macro, but not his attributes
Steps to Reproduce
let's say we have a "wasm" feature
#[cfg_attr(feature = "wasm", wasm_bindgen_macro::wasm_bindgen)]pubMyStruct{#[cfg_attr(feature = "wasm", wasm_bindgen(skip))]// THIS DOESN'T WORK
pub my_field:MyWrapperType,}
Expected Behavior
I'm able to use proc-macro attributes when using conditional compilation
Actual Behavior
cannot find attribute `wasm_bindgen` in this scope
`wasm_bindgen` is in scope, but it is a crate, not an attribute
consider importing one of these items:
use wasm_bindgen::prelude::wasm_bindgen;
use wasm_bindgen_macro::wasm_bindgen;
The text was updated successfully, but these errors were encountered:
You don't need the cfg_attr if your entire struct cfg'd out. But I can totally see a situation where conditionally applying wasm-bindgen attributes to fields is needed so this issue should be fixed.
Without cfg_attr on the attribute you get an error if the feature isn't
active since the attribute isn't recognized by any proc macro
Il ven 27 ott 2023, 14:51 Muhammad Hamza ***@***.***> ha
scritto:
Describe the Bug
I'm able to apply conditionally
wasm_bindgen
proc-macro, but not his attributesSteps to Reproduce
let's say we have a "wasm" feature
Expected Behavior
I'm able to use proc-macro attributes when using conditional compilation
Actual Behavior
The text was updated successfully, but these errors were encountered: