about summary refs log tree commit diff
path: root/compiler/rustc_hir/src
diff options
context:
space:
mode:
authorJacob Pratt <jacob@jhpratt.dev>2025-08-22 22:00:51 -0400
committerGitHub <noreply@github.com>2025-08-22 22:00:51 -0400
commit45d5109ad865cc0b27276690d4d2a0c8d41beef0 (patch)
tree0ef2b70c879609f55807eb9f63695d97e3c6e6d2 /compiler/rustc_hir/src
parentf0a414870a0aa295c0d35e0d980f99d5b892f72b (diff)
parent291da71b2ae2e5d313739a7d6a8ffa634f408db5 (diff)
downloadrust-45d5109ad865cc0b27276690d4d2a0c8d41beef0.tar.gz
rust-45d5109ad865cc0b27276690d4d2a0c8d41beef0.zip
Rollup merge of #145573 - veluca93:unsafe-force-target-feature, r=davidtwco
Add an experimental unsafe(force_target_feature) attribute.

This uses the feature gate for https://github.com/rust-lang/rust/issues/143352, but is described in https://github.com/rust-lang/rfcs/pull/3820 which is strongly tied to the experiment.
Diffstat (limited to 'compiler/rustc_hir/src')
-rw-r--r--compiler/rustc_hir/src/attrs/data_structures.rs5
-rw-r--r--compiler/rustc_hir/src/attrs/encode_cross_crate.rs2
2 files changed, 4 insertions, 3 deletions
diff --git a/compiler/rustc_hir/src/attrs/data_structures.rs b/compiler/rustc_hir/src/attrs/data_structures.rs
index a17350f0392..2209b18df3f 100644
--- a/compiler/rustc_hir/src/attrs/data_structures.rs
+++ b/compiler/rustc_hir/src/attrs/data_structures.rs
@@ -524,8 +524,9 @@ pub enum AttributeKind {
     /// Represents `#[rustc_std_internal_symbol]`.
     StdInternalSymbol(Span),
 
-    /// Represents `#[target_feature(enable = "...")]`
-    TargetFeature(ThinVec<(Symbol, Span)>, Span),
+    /// Represents `#[target_feature(enable = "...")]` and
+    /// `#[unsafe(force_target_feature(enable = "...")]`.
+    TargetFeature { features: ThinVec<(Symbol, Span)>, attr_span: Span, was_forced: bool },
 
     /// Represents `#[track_caller]`
     TrackCaller(Span),
diff --git a/compiler/rustc_hir/src/attrs/encode_cross_crate.rs b/compiler/rustc_hir/src/attrs/encode_cross_crate.rs
index defabdccc02..485ded3981f 100644
--- a/compiler/rustc_hir/src/attrs/encode_cross_crate.rs
+++ b/compiler/rustc_hir/src/attrs/encode_cross_crate.rs
@@ -78,7 +78,7 @@ impl AttributeKind {
             SpecializationTrait(..) => No,
             Stability { .. } => Yes,
             StdInternalSymbol(..) => No,
-            TargetFeature(..) => No,
+            TargetFeature { .. } => No,
             TrackCaller(..) => Yes,
             TypeConst(..) => Yes,
             UnsafeSpecializationMarker(..) => No,