-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Labels
A-macrosArea: All kinds of macros (custom derive, macro_rules!, proc macros, ..)Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..)A-resolveArea: Name/path resolution done by `rustc_resolve` specificallyArea: Name/path resolution done by `rustc_resolve` specificallyP-highHigh priorityHigh priorityT-langRelevant to the language teamRelevant to the language teamregression-from-stable-to-nightlyPerformance or correctness regression from stable to nightly.Performance or correctness regression from stable to nightly.
Description
In the newest nightly all attributes with names identical to existing macros are parsed as macro invocation (note the lack of !
at the front of dummy
in the example below).
Previous version nightly-2018-08-17
works as expected.
This breaks compilation of some of our custom derives, using same name for attributes and macros, which was previously allowed.
I tried this code:
macro_rules! dummy {
($x:expr) => {
println!("dummy: {}", $x)
}
}
#[dummy("text")] // this should not be regarded as a `dummy` macro invocation, should it?
struct SampleStruct {
}
fn main() {
dummy!("text");
}
I expected this to complain about unknown custom attribute dummy
Instead, I got this error:
error: macro `dummy` may not be used in attributes
--> src/main.rs:7:1
|
7 | #[dummy("text")]
| ^^^^^^^^^^^^^^^^
Meta
rustc --version --verbose
:
rustc 1.30.0-nightly (33b923fd4 2018-08-18)
binary: rustc
commit-hash: 33b923fd44c5c5925e635815fce68bdf1f98740f
commit-date: 2018-08-18
host: x86_64-unknown-linux-gnu
release: 1.30.0-nightly
LLVM version: 7.0
Metadata
Metadata
Assignees
Labels
A-macrosArea: All kinds of macros (custom derive, macro_rules!, proc macros, ..)Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..)A-resolveArea: Name/path resolution done by `rustc_resolve` specificallyArea: Name/path resolution done by `rustc_resolve` specificallyP-highHigh priorityHigh priorityT-langRelevant to the language teamRelevant to the language teamregression-from-stable-to-nightlyPerformance or correctness regression from stable to nightly.Performance or correctness regression from stable to nightly.