-
-
Notifications
You must be signed in to change notification settings - Fork 14.9k
riscv: promote d, e, and f target_features to CfgStableToggleUnstable #156188
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
romancardenas
wants to merge
3
commits into
rust-lang:main
Choose a base branch
from
romancardenas:riscv-target-feature-cfg-stable-toggle-unstable
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
tests/ui/target-feature/abi-incompatible-target-feature-flag-enable.riscv.stderr
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
tests/ui/target-feature/abi-required-target-feature-flag-disable.riscv.stderr
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
tests/ui/target-feature/cfg-stable-toggle-unstable-target-feature-attribute-riscv.rs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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() {} |
23 changes: 23 additions & 0 deletions
23
tests/ui/target-feature/cfg-stable-toggle-unstable-target-feature-attribute-riscv.stderr
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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`. |
17 changes: 17 additions & 0 deletions
17
tests/ui/target-feature/cfg-stable-toggle-unstable-target-feature-flag-enable-riscv.rs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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` |
10 changes: 10 additions & 0 deletions
10
tests/ui/target-feature/cfg-stable-toggle-unstable-target-feature-flag-enable-riscv.stderr
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 | ||
|
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add tests which show that we properly error/warn when using
#[target_feature(enable = "f")]or-Ctarget-feature=f.View changes since the review
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added a couple of tests and adapted previous tests to work with this change.