about summary refs log tree commit diff
path: root/compiler/rustc_ast/src/ast.rs
diff options
context:
space:
mode:
authoryukang <moorekang@gmail.com>2024-08-02 00:28:57 +0800
committeryukang <moorekang@gmail.com>2024-08-04 00:11:16 +0800
commit22aa104bce457e7d70b05d7a32cdf09f25ac06b1 (patch)
tree6432b6960ec98d08d8cac6b7bf30428fddbb0d7e /compiler/rustc_ast/src/ast.rs
parent70591dc15db32941fe3595fdbf98e58d6975f95e (diff)
downloadrust-22aa104bce457e7d70b05d7a32cdf09f25ac06b1.tar.gz
rust-22aa104bce457e7d70b05d7a32cdf09f25ac06b1.zip
don't suggest turning crate-level attributes into outer style
Diffstat (limited to 'compiler/rustc_ast/src/ast.rs')
-rw-r--r--compiler/rustc_ast/src/ast.rs11
1 files changed, 11 insertions, 0 deletions
diff --git a/compiler/rustc_ast/src/ast.rs b/compiler/rustc_ast/src/ast.rs
index fc1af3fc3dd..0c81c0f4c93 100644
--- a/compiler/rustc_ast/src/ast.rs
+++ b/compiler/rustc_ast/src/ast.rs
@@ -2898,6 +2898,17 @@ pub struct AttrItem {
     pub tokens: Option<LazyAttrTokenStream>,
 }
 
+impl AttrItem {
+    pub fn is_valid_for_outer_style(&self) -> bool {
+        self.path == sym::cfg_attr
+            || self.path == sym::cfg
+            || self.path == sym::forbid
+            || self.path == sym::warn
+            || self.path == sym::allow
+            || self.path == sym::deny
+    }
+}
+
 /// `TraitRef`s appear in impls.
 ///
 /// Resolution maps each `TraitRef`'s `ref_id` to its defining trait; that's all