Skip to content

Attributes on macro-generated macro invocations are not feature-gate-checked #32782

Closed
@LeoTestard

Description

@LeoTestard

There are currently two phases of feature-gate checking: one before and one after macro expansion. The first one can check attributes on macro invocations that are removed by expansion, and the second one can check attributes on items generated by macro expansion. The thing is that items generated by macro expansion which are themselves macro invocations are not checked:

macro_rules! bar (
    () => ()
);

macro_rules! foo (
    () => (
        #[allow_internal_unstable]
        bar!();
    );
);

foo!();

This compiles on nightly. I've got an incoming PR that fixes this, along with #32648.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions