about summary refs log tree commit diff
path: root/compiler/rustc_feature/src
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2022-01-18 04:41:59 +0100
committerGitHub <noreply@github.com>2022-01-18 04:41:59 +0100
commit804072fdfc4db19b4f3deac52fe8318a52ce19b5 (patch)
treefb466381c46f3ad7685d07f5772b6c4d83d2bd85 /compiler/rustc_feature/src
parentcb5ecff8b2c4cd083cb1429d4e14e083812dd0a7 (diff)
parentb59e743666adba7ad0eb1a8eaea5c5ffb7086e01 (diff)
downloadrust-804072fdfc4db19b4f3deac52fe8318a52ce19b5.tar.gz
rust-804072fdfc4db19b4f3deac52fe8318a52ce19b5.zip
Rollup merge of #92701 - ehuss:even-more-attr-validation, r=matthewjasper
Add some more attribute validation

This adds some more validation for the position of attributes:

* `link` is only valid on an `extern` block
* `windows_subsystem` and `no_builtins` are only valid at the crate level
Diffstat (limited to 'compiler/rustc_feature/src')
-rw-r--r--compiler/rustc_feature/src/builtin_attrs.rs4
1 files changed, 2 insertions, 2 deletions
diff --git a/compiler/rustc_feature/src/builtin_attrs.rs b/compiler/rustc_feature/src/builtin_attrs.rs
index 5309f217b4a..723cc06864a 100644
--- a/compiler/rustc_feature/src/builtin_attrs.rs
+++ b/compiler/rustc_feature/src/builtin_attrs.rs
@@ -352,7 +352,7 @@ pub const BUILTIN_ATTRIBUTES: &[BuiltinAttribute] = &[
 
     // Runtime
     ungated!(
-        windows_subsystem, Normal,
+        windows_subsystem, CrateLevel,
         template!(NameValueStr: "windows|console"), FutureWarnFollowing
     ),
     ungated!(panic_handler, Normal, template!(Word), WarnFollowing), // RFC 2070
@@ -360,7 +360,7 @@ pub const BUILTIN_ATTRIBUTES: &[BuiltinAttribute] = &[
     // Code generation:
     ungated!(inline, Normal, template!(Word, List: "always|never"), FutureWarnFollowing),
     ungated!(cold, Normal, template!(Word), WarnFollowing),
-    ungated!(no_builtins, Normal, template!(Word), WarnFollowing),
+    ungated!(no_builtins, CrateLevel, template!(Word), WarnFollowing),
     ungated!(target_feature, Normal, template!(List: r#"enable = "name""#), DuplicatesOk),
     ungated!(track_caller, Normal, template!(Word), WarnFollowing),
     gated!(