summaryrefslogtreecommitdiffstats
path: root/compiler/rustc_parse/src/parser/attr.rs
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-30 03:57:31 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-30 03:57:31 +0000
commitdc0db358abe19481e475e10c32149b53370f1a1c (patch)
treeab8ce99c4b255ce46f99ef402c27916055b899ee /compiler/rustc_parse/src/parser/attr.rs
parentReleasing progress-linux version 1.71.1+dfsg1-2~progress7.99u1. (diff)
downloadrustc-dc0db358abe19481e475e10c32149b53370f1a1c.tar.xz
rustc-dc0db358abe19481e475e10c32149b53370f1a1c.zip
Merging upstream version 1.72.1+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'compiler/rustc_parse/src/parser/attr.rs')
-rw-r--r--compiler/rustc_parse/src/parser/attr.rs17
1 files changed, 7 insertions, 10 deletions
diff --git a/compiler/rustc_parse/src/parser/attr.rs b/compiler/rustc_parse/src/parser/attr.rs
index e1db19557..ee0abba1c 100644
--- a/compiler/rustc_parse/src/parser/attr.rs
+++ b/compiler/rustc_parse/src/parser/attr.rs
@@ -422,15 +422,12 @@ impl<'a> Parser<'a> {
}
}
-pub fn maybe_needs_tokens(attrs: &[ast::Attribute]) -> bool {
- // One of the attributes may either itself be a macro,
- // or expand to macro attributes (`cfg_attr`).
- attrs.iter().any(|attr| {
- if attr.is_doc_comment() {
- return false;
- }
- attr.ident().map_or(true, |ident| {
- ident.name == sym::cfg_attr || !rustc_feature::is_builtin_attr_name(ident.name)
- })
+/// The attributes are complete if all attributes are either a doc comment or a builtin attribute other than `cfg_attr`
+pub fn is_complete(attrs: &[ast::Attribute]) -> bool {
+ attrs.iter().all(|attr| {
+ attr.is_doc_comment()
+ || attr.ident().is_some_and(|ident| {
+ ident.name != sym::cfg_attr && rustc_feature::is_builtin_attr_name(ident.name)
+ })
})
}