about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorMatthias Krüger <476013+matthiaskrgr@users.noreply.github.com>2025-06-13 05:19:13 +0200
committerGitHub <noreply@github.com>2025-06-13 05:19:13 +0200
commit1a865fbe4e3bf3fa94cdc425c26ca919c6f8288f (patch)
treec200b4460165ad7806cd0e0ecbeaa5643154ce8a /src
parent8002683e9957f428b2c0c258f0e2ecb8dd4e9272 (diff)
parent5601490c9d889ff8d964d4aafd44dcdeea40bfef (diff)
downloadrust-1a865fbe4e3bf3fa94cdc425c26ca919c6f8288f.tar.gz
rust-1a865fbe4e3bf3fa94cdc425c26ca919c6f8288f.zip
Rollup merge of #135927 - azhogin:azhogin/retpoline, r=davidtwco
retpoline and retpoline-external-thunk flags (target modifiers) to enable retpoline-related target features

`-Zretpoline` and `-Zretpoline-external-thunk` flags are target modifiers (tracked to be equal in linked crates).
* Enables target features for `-Zretpoline-external-thunk`:
`+retpoline-external-thunk`, `+retpoline-indirect-branches`, `+retpoline-indirect-calls`.
* Enables target features for `-Zretpoline`:
`+retpoline-indirect-branches`, `+retpoline-indirect-calls`.

It corresponds to clang -mretpoline & -mretpoline-external-thunk flags.

Also this PR forbids to specify those target features manually (warning).

Issue: rust-lang/rust#116852
Diffstat (limited to 'src')
-rw-r--r--src/librustdoc/json/mod.rs5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/librustdoc/json/mod.rs b/src/librustdoc/json/mod.rs
index 131a12ce228..0ceeea2b9b1 100644
--- a/src/librustdoc/json/mod.rs
+++ b/src/librustdoc/json/mod.rs
@@ -18,6 +18,7 @@ use rustc_data_structures::fx::FxHashSet;
 use rustc_hir::def_id::{DefId, DefIdSet};
 use rustc_middle::ty::TyCtxt;
 use rustc_session::Session;
+use rustc_session::features::StabilityExt;
 use rustc_span::def_id::LOCAL_CRATE;
 use rustdoc_json_types as types;
 // It's important to use the FxHashMap from rustdoc_json_types here, instead of
@@ -148,7 +149,7 @@ fn target(sess: &rustc_session::Session) -> types::Target {
             .copied()
             .filter(|(_, stability, _)| {
                 // Describe only target features which the user can toggle
-                stability.toggle_allowed().is_ok()
+                stability.is_toggle_permitted(sess).is_ok()
             })
             .map(|(name, stability, implied_features)| {
                 types::TargetFeature {
@@ -164,7 +165,7 @@ fn target(sess: &rustc_session::Session) -> types::Target {
                             // Imply only target features which the user can toggle
                             feature_stability
                                 .get(name)
-                                .map(|stability| stability.toggle_allowed().is_ok())
+                                .map(|stability| stability.is_toggle_permitted(sess).is_ok())
                                 .unwrap_or(false)
                         })
                         .map(String::from)