@@ -87,7 +87,10 @@ pub(crate) fn from_target_feature_attr(
87
87
// But ensure the ABI does not forbid enabling this.
88
88
// Here we do assume that LLVM doesn't add even more implied features
89
89
// we don't know about, at least no features that would have ABI effects!
90
- if abi_feature_constraints. incompatible . contains ( & name. as_str ( ) ) {
90
+ // We skip this check in rustdoc, like we skip all target feature related checks.
91
+ if !tcx. sess . opts . actually_rustdoc
92
+ && abi_feature_constraints. incompatible . contains ( & name. as_str ( ) )
93
+ {
91
94
tcx. dcx ( ) . emit_err ( errors:: ForbiddenTargetFeatureAttr {
92
95
span : item. span ( ) ,
93
96
feature : name. as_str ( ) ,
@@ -142,8 +145,11 @@ pub(crate) fn provide(providers: &mut Providers) {
142
145
rust_target_features : |tcx, cnum| {
143
146
assert_eq ! ( cnum, LOCAL_CRATE ) ;
144
147
if tcx. sess . opts . actually_rustdoc {
145
- // rustdoc needs to be able to document functions that use all the features, so
146
- // whitelist them all
148
+ // HACK: rustdoc would like to pretend that we have all the target features, so we
149
+ // have to merge all the lists into one. The result has a "random" stability
150
+ // (depending on the order in which we consider features); all places that check
151
+ // target stability are expected to check `actually_rustdoc` and do nothing when
152
+ // that is set.
147
153
rustc_target:: target_features:: all_rust_features ( )
148
154
. map ( |( a, b) | ( a. to_string ( ) , b) )
149
155
. collect ( )
0 commit comments