about summary refs log tree commit diff
path: root/compiler/rustc_parse/src/validate_attr.rs
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2025-03-27 18:33:31 +0000
committerbors <bors@rust-lang.org>2025-03-27 18:33:31 +0000
commit3f5502370b8f60e4df98deba4c22ea26f4f6be55 (patch)
tree3fe8d3b8820e6927a39e17138439874fc54298bd /compiler/rustc_parse/src/validate_attr.rs
parent217693a1f02ca6431a434926ff3417bdb6dbac2e (diff)
parent1b8089d553f284a0cd6f2969a89459f3e1cf824b (diff)
downloadrust-3f5502370b8f60e4df98deba4c22ea26f4f6be55.tar.gz
rust-3f5502370b8f60e4df98deba4c22ea26f4f6be55.zip
Auto merge of #139023 - jhpratt:rollup-4ou6ei4, r=jhpratt
Rollup of 7 pull requests

Successful merges:

 - #138844 (expand: Leave traces when expanding `cfg` attributes)
 - #138926 (Remove `kw::Empty` uses from `rustc_middle`.)
 - #138989 (Clean up a few things in rustc_hir_analysis::check::region)
 - #138999 (Report compiletest pass mode if forced)
 - #139014 (Improve suggest construct with literal syntax instead of calling)
 - #139015 (Remove unneeded LLVM CI test assertions)
 - #139016 (Add job duration changes to post-merge analysis report)

r? `@ghost`
`@rustbot` modify labels: rollup
Diffstat (limited to 'compiler/rustc_parse/src/validate_attr.rs')
-rw-r--r--compiler/rustc_parse/src/validate_attr.rs9
1 files changed, 3 insertions, 6 deletions
diff --git a/compiler/rustc_parse/src/validate_attr.rs b/compiler/rustc_parse/src/validate_attr.rs
index 9ecde2a9eb5..6bbd650dcdf 100644
--- a/compiler/rustc_parse/src/validate_attr.rs
+++ b/compiler/rustc_parse/src/validate_attr.rs
@@ -16,7 +16,8 @@ use rustc_span::{Span, Symbol, sym};
 use crate::{errors, parse_in};
 
 pub fn check_attr(psess: &ParseSess, attr: &Attribute) {
-    if attr.is_doc_comment() || attr.has_name(sym::cfg_attr_trace) {
+    if attr.is_doc_comment() || attr.has_name(sym::cfg_trace) || attr.has_name(sym::cfg_attr_trace)
+    {
         return;
     }
 
@@ -215,11 +216,7 @@ pub fn check_builtin_meta_item(
     template: AttributeTemplate,
     deny_unsafety: bool,
 ) {
-    // Some special attributes like `cfg` must be checked
-    // before the generic check, so we skip them here.
-    let should_skip = |name| name == sym::cfg;
-
-    if !should_skip(name) && !is_attr_template_compatible(&template, &meta.kind) {
+    if !is_attr_template_compatible(&template, &meta.kind) {
         emit_malformed_attribute(psess, style, meta.span, name, template);
     }