Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
8 changes: 4 additions & 4 deletions compiler/rustc_target/src/target_features.rs
Original file line number Diff line number Diff line change
Expand Up @@ -963,12 +963,12 @@ impl Target {
// about what the intended ABI is.
match &*self.llvm_abiname {
"ilp32d" | "lp64d" => {
// Requires d (which implies f), incompatible with e.
FeatureConstraints { required: &["d"], incompatible: &["e"] }
// Requires d (which implies f), incompatible with e and zfinx.
FeatureConstraints { required: &["d"], incompatible: &["e", "zfinx"] }
}
"ilp32f" | "lp64f" => {
// Requires f, incompatible with e.
FeatureConstraints { required: &["f"], incompatible: &["e"] }
// Requires f, incompatible with e and zfinx.
FeatureConstraints { required: &["f"], incompatible: &["e", "zfinx"] }
}
"ilp32" | "lp64" => {
// Requires nothing, incompatible with e.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
error: target feature `d` cannot be enabled with `#[target_feature]`: this feature is incompatible with the target ABI
--> $DIR/forbidden-hardfloat-target-feature-attribute.rs:10:18
--> $DIR/forbidden-hardfloat-target-feature-attribute-e-d.rs:10:18
|
LL | #[target_feature(enable = "d")]
| ^^^^^^^^^^^^
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
//! Ensure ABI-incompatible features cannot be enabled via `#[target_feature]`.
//@ compile-flags: --target=riscv64gc-unknown-linux-gnu --crate-type=lib
//@ needs-llvm-components: riscv
#![feature(no_core, lang_items, riscv_target_feature)]
#![no_core]

#[lang = "sized"]
pub trait Sized {}

#[target_feature(enable = "zdinx")]
//~^ERROR: cannot be enabled with
pub unsafe fn my_fun() {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
error: target feature `zfinx` cannot be enabled with `#[target_feature]`: this feature is incompatible with the target ABI
--> $DIR/forbidden-hardfloat-target-feature-attribute-f-zfinx.rs:10:18
|
LL | #[target_feature(enable = "zdinx")]
| ^^^^^^^^^^^^^^^^

error: aborting due to 1 previous error

Loading