diff options
| author | bors <bors@rust-lang.org> | 2020-11-20 00:51:54 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2020-11-20 00:51:54 +0000 |
| commit | 4ec27e4b79891b0ebc2ad71a3c4ac94f67d93f93 (patch) | |
| tree | 602e46b3159e5835cba6bcb4e8441189f2aa0d8e /compiler/rustc_parse/src/parser | |
| parent | 09c9c9f7da72b774cc445c0f56fc0b9792a49647 (diff) | |
| parent | 5adc00fbb8a40ecc685b26abfce0a4b619eb4c88 (diff) | |
| download | rust-4ec27e4b79891b0ebc2ad71a3c4ac94f67d93f93.tar.gz rust-4ec27e4b79891b0ebc2ad71a3c4ac94f67d93f93.zip | |
Auto merge of #79220 - Dylan-DPC:rollup-5bpbygd, r=Dylan-DPC
Rollup of 11 pull requests
Successful merges:
- #79119 (Clarify availability of atomic operations)
- #79123 (Add u128 and i128 integer tests)
- #79177 (Test drop order for (destructuring) assignments)
- #79181 (rustdoc: add [src] links to methods on a trait's page)
- #79183 (Make compiletest testing use the local sysroot)
- #79185 (expand/resolve: Pre-requisites to "Turn `#[derive]` into a regular macro attribute")
- #79193 (Revert #78969 "Normalize function type during validation")
- #79194 (Make as{_mut,}_slice on array::IntoIter public)
- #79204 (Add jyn514 email alias to mailmap)
- #79212 (Move `rustc_ty` -> `rustc_ty_utils`)
- #79217 (Add the "memcpy" doc alias to slice::copy_from_slice)
Failed merges:
r? `@ghost`
`@rustbot` modify labels: rollup
Diffstat (limited to 'compiler/rustc_parse/src/parser')
| -rw-r--r-- | compiler/rustc_parse/src/parser/attr.rs | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/compiler/rustc_parse/src/parser/attr.rs b/compiler/rustc_parse/src/parser/attr.rs index 3738fbaeac8..41985757b57 100644 --- a/compiler/rustc_parse/src/parser/attr.rs +++ b/compiler/rustc_parse/src/parser/attr.rs @@ -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) + }) }) } |
