Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
rustdoc: disable forbidden #[target_feature] check
(cherry picked from commit b6f2240)
  • Loading branch information
RalfJung authored and cuviper committed Mar 14, 2025
commit d4de520fc458f67758ad7d7fb024e065f840f61e
7 changes: 5 additions & 2 deletions compiler/rustc_codegen_ssa/src/target_features.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what an odd melange of hunks this winds up being...

rustc_target::target_features::all_rust_features()
.map(|(a, b)| (a.to_string(), b.compute_toggleability(target)))
.collect()
Expand Down