also skip abi_required_features check in rustdoc
This commit is contained in:
parent
dc04c0ca48
commit
4c939db0e7
2 changed files with 24 additions and 9 deletions
|
@ -87,12 +87,17 @@ pub(crate) fn from_target_feature_attr(
|
||||||
// But ensure the ABI does not forbid enabling this.
|
// But ensure the ABI does not forbid enabling this.
|
||||||
// Here we do assume that LLVM doesn't add even more implied features
|
// Here we do assume that LLVM doesn't add even more implied features
|
||||||
// we don't know about, at least no features that would have ABI effects!
|
// we don't know about, at least no features that would have ABI effects!
|
||||||
if abi_feature_constraints.incompatible.contains(&name.as_str()) {
|
// We skip this logic in rustdoc, where we want to allow all target features of
|
||||||
tcx.dcx().emit_err(errors::ForbiddenTargetFeatureAttr {
|
// all targets, so we can't check their ABI compatibility and anyway we are not
|
||||||
span: item.span(),
|
// generating code so "it's fine".
|
||||||
feature: name.as_str(),
|
if !tcx.sess.opts.actually_rustdoc {
|
||||||
reason: "this feature is incompatible with the target ABI",
|
if abi_feature_constraints.incompatible.contains(&name.as_str()) {
|
||||||
});
|
tcx.dcx().emit_err(errors::ForbiddenTargetFeatureAttr {
|
||||||
|
span: item.span(),
|
||||||
|
feature: name.as_str(),
|
||||||
|
reason: "this feature is incompatible with the target ABI",
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
target_features.push(TargetFeature { name, implied: name != feature_sym })
|
target_features.push(TargetFeature { name, implied: name != feature_sym })
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,9 +1,13 @@
|
||||||
//! This is a regression test for <https://github.com/rust-lang/rust/issues/137366>, ensuring
|
//! This is a regression test for <https://github.com/rust-lang/rust/issues/137366>, ensuring
|
||||||
//! that we can use the `neon` target feature on ARM-32 targets in rustdoc despite there
|
//! that we can use the `neon` target feature on ARM32 targets in rustdoc despite there
|
||||||
//! being a "forbidden" feature of the same name for aarch64, and rustdoc merging the
|
//! being a "forbidden" feature of the same name for aarch64, and rustdoc merging the
|
||||||
//! target features of all targets.
|
//! target features of all targets.
|
||||||
//@ check-pass
|
//@ check-pass
|
||||||
//@ compile-flags: --target armv7-unknown-linux-gnueabihf
|
//@ revisions: arm aarch64
|
||||||
|
//@[arm] compile-flags: --target armv7-unknown-linux-gnueabihf
|
||||||
|
//@[arm] needs-llvm-components: arm
|
||||||
|
//@[aarch64] compile-flags: --target aarch64-unknown-none-softfloat
|
||||||
|
//@[aarch64] needs-llvm-components: aarch64
|
||||||
|
|
||||||
#![crate_type = "lib"]
|
#![crate_type = "lib"]
|
||||||
#![feature(no_core, lang_items)]
|
#![feature(no_core, lang_items)]
|
||||||
|
@ -15,4 +19,10 @@ pub trait Sized {}
|
||||||
|
|
||||||
// `fp-armv8` is "forbidden" on aarch64 as we tie it to `neon`.
|
// `fp-armv8` is "forbidden" on aarch64 as we tie it to `neon`.
|
||||||
#[target_feature(enable = "fp-armv8")]
|
#[target_feature(enable = "fp-armv8")]
|
||||||
pub fn fun() {}
|
pub fn fun1() {}
|
||||||
|
|
||||||
|
// This would usually be rejected as it changes the ABI.
|
||||||
|
// But we disable that check in rustdoc since we are building "for all targets" and the
|
||||||
|
// check can't really handle that.
|
||||||
|
#[target_feature(enable = "soft-float")]
|
||||||
|
pub fn fun2() {}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue