Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit b072867

Browse files
committedFeb 28, 2025
also skip abi_required_features check in rustdoc
1 parent dc04c0c commit b072867

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed
 

‎compiler/rustc_codegen_ssa/src/target_features.rs

+11-6
Original file line numberDiff line numberDiff line change
@@ -87,12 +87,17 @@ pub(crate) fn from_target_feature_attr(
8787
// But ensure the ABI does not forbid enabling this.
8888
// Here we do assume that LLVM doesn't add even more implied features
8989
// we don't know about, at least no features that would have ABI effects!
90-
if abi_feature_constraints.incompatible.contains(&name.as_str()) {
91-
tcx.dcx().emit_err(errors::ForbiddenTargetFeatureAttr {
92-
span: item.span(),
93-
feature: name.as_str(),
94-
reason: "this feature is incompatible with the target ABI",
95-
});
90+
// We skip this logic in rustdoc, where we want to allow all target features of
91+
// all targets, so we can't check their ABI compatibility and anyway we are not
92+
// generating code so "it's fine".
93+
if tcx.sess.opts.actually_rustdoc {
94+
if abi_feature_constraints.incompatible.contains(&name.as_str()) {
95+
tcx.dcx().emit_err(errors::ForbiddenTargetFeatureAttr {
96+
span: item.span(),
97+
feature: name.as_str(),
98+
reason: "this feature is incompatible with the target ABI",
99+
});
100+
}
96101
}
97102
target_features.push(TargetFeature { name, implied: name != feature_sym })
98103
}

0 commit comments

Comments
 (0)
Failed to load comments.