Rollup merge of #79185 - petrochenkov:derattr2, r=Aaron1011
expand/resolve: Pre-requisites to "Turn `#[derive]` into a regular macro attribute" Miscellaneous refactorings and error reporting changes extracted from https://github.com/rust-lang/rust/pull/79078. Unlike https://github.com/rust-lang/rust/pull/79078 this PR doesn't make any observable changes to the language or library. r? ```@Aaron1011```
This commit is contained in:
commit
8216b359e5
33 changed files with 480 additions and 653 deletions
|
@ -312,14 +312,13 @@ impl<'a> Parser<'a> {
|
|||
}
|
||||
|
||||
pub fn maybe_needs_tokens(attrs: &[ast::Attribute]) -> bool {
|
||||
// One of the attributes may either itself be a macro, or apply derive macros (`derive`),
|
||||
// or expand to macro attributes (`cfg_attr`).
|
||||
attrs.iter().any(|attr| {
|
||||
if let Some(ident) = attr.ident() {
|
||||
attr.ident().map_or(true, |ident| {
|
||||
ident.name == sym::derive
|
||||
// This might apply a custom attribute/derive
|
||||
|| ident.name == sym::cfg_attr
|
||||
|| !rustc_feature::is_builtin_attr_name(ident.name)
|
||||
} else {
|
||||
true
|
||||
}
|
||||
|| ident.name == sym::cfg_attr
|
||||
|| !rustc_feature::is_builtin_attr_name(ident.name)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue