Skip to content

Allow conditional compilation when using wasm_bindgen proc-macro #3671

Open
@nappa85

Description

@nappa85

Describe the Bug

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)]
pub MyStruct {
  #[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;

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions