Skip to content

Hygiene affected when using multiple derive #47346

Description

@antoyo

Hi.
I have a proc-macro that generates a macro_rules!.
When I only do:

#[derive(MyCustomDerive)]
struct MyStruct {
}

I can use the generated macro.

However, if I add another custom derive like in:

#[derive(Serialize, MyCustomDerive)]
struct MyStruct {
}

I cannot use the macro anymore…
I get the error:

cannot find macro `my_macro!` in this scope

Strangely, if I do:

#[derive(MyCustomDerive, Serialize)]
struct MyStruct {
}

Putting the serde custom derive after mine fix the issue.
I don't know if it is related to serde or just a bug with multiple custom derives.
Thanks to fix this issue.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-decl-macros-2-0Area: Declarative macros 2.0 (#39412)C-bugCategory: This is a bug.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions