-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
forbid toggling x87 and fpregs on hard-float targets
- Loading branch information
Showing
21 changed files
with
129 additions
and
10 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
11 changes: 11 additions & 0 deletions
11
tests/ui/target-feature/allowed-softfloat-target-feature-attribute.rs
This file contains 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,11 @@ | ||
//@ compile-flags: --target=x86_64-unknown-none --crate-type=lib | ||
//@ needs-llvm-components: x86 | ||
//@ build-pass | ||
#![feature(no_core, lang_items, x87_target_feature)] | ||
#![no_core] | ||
|
||
#[lang = "sized"] | ||
pub trait Sized {} | ||
|
||
#[target_feature(enable = "x87")] | ||
pub unsafe fn my_fun() {} |
9 changes: 9 additions & 0 deletions
9
tests/ui/target-feature/allowed-softfloat-target-feature-flag-disable.rs
This file contains 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,9 @@ | ||
//@ compile-flags: --target=x86_64-unknown-none --crate-type=lib | ||
//@ needs-llvm-components: x86 | ||
//@ compile-flags: -Ctarget-feature=-x87 | ||
//@ build-pass | ||
#![feature(no_core, lang_items)] | ||
#![no_core] | ||
|
||
#[lang = "sized"] | ||
pub trait Sized {} |
6 changes: 6 additions & 0 deletions
6
tests/ui/target-feature/allowed-softfloat-target-feature-flag-disable.stderr
This file contains 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,6 @@ | ||
warning: unstable feature specified for `-Ctarget-feature`: `x87` | ||
| | ||
= note: this feature is not stably supported; its behavior can change in the future | ||
|
||
warning: 1 warning emitted | ||
|
11 changes: 11 additions & 0 deletions
11
tests/ui/target-feature/forbidden-hardfloat-target-feature-attribute.rs
This file contains 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,11 @@ | ||
//@ compile-flags: --target=x86_64-unknown-linux-gnu --crate-type=lib | ||
//@ needs-llvm-components: x86 | ||
#![feature(no_core, lang_items)] | ||
#![no_core] | ||
|
||
#[lang = "sized"] | ||
pub trait Sized {} | ||
|
||
#[target_feature(enable = "x87")] | ||
//~^ERROR: cannot be toggled with | ||
pub unsafe fn my_fun() {} |
8 changes: 8 additions & 0 deletions
8
tests/ui/target-feature/forbidden-hardfloat-target-feature-attribute.stderr
This file contains 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,8 @@ | ||
error: target feature `x87` cannot be toggled with `#[target_feature]`: unsound on hard-float targets because it changes float ABI | ||
--> $DIR/forbidden-hardfloat-target-feature-attribute.rs:9:18 | ||
| | ||
LL | #[target_feature(enable = "x87")] | ||
| ^^^^^^^^^^^^^^ | ||
|
||
error: aborting due to 1 previous error | ||
|
14 changes: 14 additions & 0 deletions
14
tests/ui/target-feature/forbidden-hardfloat-target-feature-cfg.rs
This file contains 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,14 @@ | ||
//@ compile-flags: --target=x86_64-unknown-linux-gnu --crate-type=lib | ||
//@ needs-llvm-components: x86 | ||
//@ check-pass | ||
#![feature(no_core, lang_items)] | ||
#![no_core] | ||
#![allow(unexpected_cfgs)] | ||
|
||
#[lang = "sized"] | ||
pub trait Sized {} | ||
|
||
// The compile_error macro does not exist, so if the `cfg` evaluates to `true` this | ||
// complains about the missing macro rather than showing the error... but that's good enough. | ||
#[cfg(not(target_feature = "x87"))] | ||
compile_error!("the x87 feature *should* be exposed in `cfg`"); |
10 changes: 10 additions & 0 deletions
10
tests/ui/target-feature/forbidden-hardfloat-target-feature-flag-disable.rs
This file contains 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 @@ | ||
//@ compile-flags: --target=x86_64-unknown-linux-gnu --crate-type=lib | ||
//@ needs-llvm-components: x86 | ||
//@ compile-flags: -Ctarget-feature=-x87 | ||
// For now this is just a warning. | ||
//@ build-pass | ||
#![feature(no_core, lang_items)] | ||
#![no_core] | ||
|
||
#[lang = "sized"] | ||
pub trait Sized {} |
7 changes: 7 additions & 0 deletions
7
tests/ui/target-feature/forbidden-hardfloat-target-feature-flag-disable.stderr
This file contains 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,7 @@ | ||
warning: target feature `x87` cannot be toggled with `-Ctarget-feature`: unsound on hard-float targets because it changes float ABI | ||
| | ||
= note: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! | ||
= note: for more information, see issue #116344 <https://github.com/rust-lang/rust/issues/116344> | ||
|
||
warning: 1 warning emitted | ||
|
This file contains 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/forbidden-target-feature-attribute.stderr
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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