Skip to content
This repository was archived by the owner on Oct 6, 2024. It is now read-only.
This repository was archived by the owner on Oct 6, 2024. It is now read-only.

Conflict with extended_key_value_attributes #63

@dtolnay

Description

@dtolnay

The following macro call compiles successfully on every rustc from 1.31.0 through 1.46.0:

macro_rules! repro {
    ($doc:expr) => {
        paste::item! {
            #[doc = $doc]
            pub struct Struct;
        }
    };
}

macro_rules! call {
    ($name:ident) => {
        repro!(stringify!($name));
    };
}

call!(documentation);

However 1.47.0 started failing with:

error: unexpected token: `stringify`
  --> src/main.rs:3:9
   |
3  | /         paste::item! {
4  | |             #[doc = $doc]
5  | |             pub struct Struct;
6  | |         }
   | |_________^
...
16 |   call!(documentation);
   |   --------------------- in this macro invocation
   |
   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)

And with a somewhat different message since 1.50.0:

error[E0658]: arbitrary expressions in key-value attributes are unstable
  --> src/main.rs:12:16
   |
12 |         repro!(stringify!($name));
   |                ^^^^^^^^^^^^^^^^^
...
16 | call!(documentation);
   | --------------------- in this macro invocation
   |
   = note: see issue #78835 <https://github.com/rust-lang/rust/issues/78835> for more information
   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions