about summary refs log tree commit diff
diff options
context:
space:
mode:
authorRalf Jung <post@ralfj.de>2025-02-25 20:26:12 +0100
committerJosh Stone <jistone@redhat.com>2025-03-14 14:12:37 -0700
commitd4de520fc458f67758ad7d7fb024e065f840f61e (patch)
treebff4276153bb0ca2e448613954bdf0e6585b69f3
parenteb2bae3fa62bc7c7bf30b576075e8aefed08b862 (diff)
downloadrust-d4de520fc458f67758ad7d7fb024e065f840f61e.tar.gz
rust-d4de520fc458f67758ad7d7fb024e065f840f61e.zip
rustdoc: disable forbidden #[target_feature] check
(cherry picked from commit b6f22400002f7921feed13e35852e3041cf2b145)
-rw-r--r--compiler/rustc_codegen_ssa/src/target_features.rs7
1 files changed, 5 insertions, 2 deletions
diff --git a/compiler/rustc_codegen_ssa/src/target_features.rs b/compiler/rustc_codegen_ssa/src/target_features.rs
index 7e80d014ea2..d673cd6e6b4 100644
--- a/compiler/rustc_codegen_ssa/src/target_features.rs
+++ b/compiler/rustc_codegen_ssa/src/target_features.rs
@@ -149,8 +149,11 @@ pub(crate) fn provide(providers: &mut Providers) {
             assert_eq!(cnum, LOCAL_CRATE);
             let target = &tcx.sess.target;
             if tcx.sess.opts.actually_rustdoc {
-                // rustdoc needs to be able to document functions that use all the features, so
-                // whitelist them all
+                // HACK: rustdoc would like to pretend that we have all the target features, so we
+                // have to merge all the lists into one. The result has a "random" stability
+                // (depending on the order in which we consider features); all places that check
+                // target stability are expected to check `actually_rustdoc` and do nothing when
+                // that is set.
                 rustc_target::target_features::all_rust_features()
                     .map(|(a, b)| (a.to_string(), b.compute_toggleability(target)))
                     .collect()