about summary refs log tree commit diff
diff options
context:
space:
mode:
authorJonathan Brouwer <jonathantbrouwer@gmail.com>2025-08-16 09:44:39 +0200
committerJonathan Brouwer <jonathantbrouwer@gmail.com>2025-08-16 09:44:39 +0200
commite8f90b12fcb51f00ba41a86ddd3f1d511d013514 (patch)
tree9276427e60babe09a66c4bba88299f44e18a425f
parent1ae7c4907275f10b3db9e886bc8809ec063e45ee (diff)
downloadrust-e8f90b12fcb51f00ba41a86ddd3f1d511d013514.tar.gz
rust-e8f90b12fcb51f00ba41a86ddd3f1d511d013514.zip
Don't show foreign types as an allowed target if the feature is not enabled
-rw-r--r--compiler/rustc_attr_parsing/src/context.rs3
1 files changed, 3 insertions, 0 deletions
diff --git a/compiler/rustc_attr_parsing/src/context.rs b/compiler/rustc_attr_parsing/src/context.rs
index bebe3350c4e..a61ca70059f 100644
--- a/compiler/rustc_attr_parsing/src/context.rs
+++ b/compiler/rustc_attr_parsing/src/context.rs
@@ -1060,6 +1060,9 @@ pub(crate) fn allowed_targets_applied(
         if !features.stmt_expr_attributes() {
             allowed_targets.retain(|t| !matches!(t, Target::Expression | Target::Statement));
         }
+        if !features.extern_types() {
+            allowed_targets.retain(|t| !matches!(t, Target::ForeignTy));
+        }
     }
 
     // We define groups of "similar" targets.