Skip to content
Open
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
6 changes: 3 additions & 3 deletions compiler/rustc_target/src/target_features.rs
Comment thread
RalfJung marked this conversation as resolved.
Original file line number Diff line number Diff line change
Expand Up @@ -610,9 +610,9 @@ static RISCV_FEATURES: &[(&str, Stability, ImpliedFeatures)] = &[
("a", Stable, &["zaamo", "zalrsc"]),
("b", Stable, &["zba", "zbb", "zbs"]),
("c", Stable, &["zca"]),
("d", Unstable(sym::riscv_target_feature), &["f"]),
("e", Unstable(sym::riscv_target_feature), &[]),
("f", Unstable(sym::riscv_target_feature), &["zicsr"]),
("d", CfgStableToggleUnstable(sym::riscv_target_feature), &["f"]),
("e", CfgStableToggleUnstable(sym::riscv_target_feature), &[]),
("f", CfgStableToggleUnstable(sym::riscv_target_feature), &["zicsr"]),
(
"forced-atomics",
Stability::Forbidden { reason: "unsound because it changes the ABI of atomic operations" },
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
warning: unstable feature specified for `-Ctarget-feature`: `d`
|
= note: this feature is not stably supported; its behavior can change in the future
= note: this feature is allowed in cfg but unstable otherwise; its behavior can change in the future

warning: target feature `d` must be disabled to ensure that the ABI of the current target can be implemented correctly
|
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
warning: unstable feature specified for `-Ctarget-feature`: `d`
|
= note: this feature is not stably supported; its behavior can change in the future
= note: this feature is allowed in cfg but unstable otherwise; its behavior can change in the future

warning: target feature `d` must be enabled to ensure that the ABI of the current target can be implemented correctly
|
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
//! Ensure cfg-only stable target_features trigger errors when enabled via attribute.
//@ compile-flags: --crate-type=lib
//@ compile-flags: --target=riscv64gc-unknown-none-elf
//@ needs-llvm-components: riscv
//@ add-minicore
//@ ignore-backends: gcc
#![feature(no_core)]
#![no_core]

extern crate minicore;
use minicore::*;

#[target_feature(enable = "v")]
//~^ERROR: the target feature `v` is currently unstable
#[target_feature(enable = "f")]
//~^ERROR: the target feature `f` is allowed in cfg but unstable otherwise
pub unsafe fn my_fun() {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
error[E0658]: the target feature `v` is currently unstable
--> $DIR/cfg-stable-toggle-unstable-target-feature-attribute-riscv.rs:13:18
|
LL | #[target_feature(enable = "v")]
| ^^^^^^^^^^^^
|
= note: see issue #150257 <https://github.com/rust-lang/rust/issues/150257> for more information
= help: add `#![feature(riscv_target_feature)]` to the crate attributes to enable
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date

error[E0658]: the target feature `f` is allowed in cfg but unstable otherwise
--> $DIR/cfg-stable-toggle-unstable-target-feature-attribute-riscv.rs:15:18
|
LL | #[target_feature(enable = "f")]
| ^^^^^^^^^^^^
|
= note: see issue #150257 <https://github.com/rust-lang/rust/issues/150257> for more information
= help: add `#![feature(riscv_target_feature)]` to the crate attributes to enable
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date

error: aborting due to 2 previous errors

For more information about this error, try `rustc --explain E0658`.
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
//! Ensure cfg-only stable target_features trigger warnings when enabled via compile flag.
//@ check-pass
//@ compile-flags: --crate-type=lib
//@ compile-flags: --target=riscv64gc-unknown-none-elf -Ctarget-feature=+v -Ctarget-feature=+f
// FIXME(#147881): *disable* the feature again for minicore as otherwise that will fail to build.
//@ minicore-compile-flags: -Ctarget-feature=-v -Ctarget-feature=-f
//@ needs-llvm-components: riscv
//@ ignore-backends: gcc
//@ add-minicore
#![feature(no_core)]
#![no_core]

extern crate minicore;
use minicore::*;

//~? WARN unstable feature specified for `-Ctarget-feature`
//~? WARN unstable feature specified for `-Ctarget-feature`
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
warning: unstable feature specified for `-Ctarget-feature`: `v`
|
= note: this feature is not stably supported; its behavior can change in the future

warning: unstable feature specified for `-Ctarget-feature`: `f`
|
= note: this feature is allowed in cfg but unstable otherwise; its behavior can change in the future

warning: 2 warnings emitted

Loading