Closed
Description
E.g. this successfully compiles on stable 1.19 / beta 1.20 /nightly
#![allow(unused)]
macro_rules! m {
($attr_path: path) => {
#[$attr_path]
fn f() {}
}
}
m!(inline<'nonexistent_lifetime, u8, NonExistentType>);
fn main() {}
There are too many kinds of attributes - built in, custom, derives, legacy derives, procedural macros, legacy procedural macros, maybe something else - I'm not sure which of them are affected. Many of these attributes are removed from AST during expansion, so simply adding a check into AST validation pass won't be enough, the checking needs to be done during expansion, like for macro paths (
rust/src/librustc_resolve/macros.rs
Line 391 in 3cf2c04
cc @jseyfried
Metadata
Metadata
Assignees
Labels
Area: Attributes (`#[…]`, `#![…]`)Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..)Area: Syntax extensionsCategory: This is a bug.High priorityRelevant to the compiler team, which will review and decide on the PR/issue.Performance or correctness regression from one stable version to another.