Stabilize cfg_target_abi

This commit is contained in:
Chris Denton 2024-01-04 19:06:37 +00:00
parent 8f359beca4
commit 93ec0e6299
No known key found for this signature in database
GPG Key ID: 713472F2F45627DE
13 changed files with 33 additions and 98 deletions

View File

@ -84,6 +84,8 @@ macro_rules! declare_features {
(accepted, cfg_doctest, "1.40.0", Some(62210)),
/// Enables `#[cfg(panic = "...")]` config key.
(accepted, cfg_panic, "1.60.0", Some(77443)),
/// Allows `cfg(target_abi = "...")`.
(accepted, cfg_target_abi, "CURRENT_RUSTC_VERSION", Some(80970)),
/// Allows `cfg(target_feature = "...")`.
(accepted, cfg_target_feature, "1.27.0", Some(29717)),
/// Allows `cfg(target_vendor = "...")`.

View File

@ -25,7 +25,6 @@ macro_rules! cfg_fn {
const GATED_CFGS: &[GatedCfg] = &[
// (name in cfg, feature, function to check if the feature is enabled)
(sym::overflow_checks, sym::cfg_overflow_checks, cfg_fn!(cfg_overflow_checks)),
(sym::target_abi, sym::cfg_target_abi, cfg_fn!(cfg_target_abi)),
(sym::target_thread_local, sym::cfg_target_thread_local, cfg_fn!(cfg_target_thread_local)),
(
sym::target_has_atomic_equal_alignment,

View File

@ -373,8 +373,6 @@ pub fn internal(&self, feature: Symbol) -> bool {
(unstable, cfg_sanitize, "1.41.0", Some(39699)),
/// Allows `cfg(sanitizer_cfi_generalize_pointers)` and `cfg(sanitizer_cfi_normalize_integers)`.
(unstable, cfg_sanitizer_cfi, "1.77.0", Some(89653)),
/// Allows `cfg(target_abi = "...")`.
(unstable, cfg_target_abi, "1.55.0", Some(80970)),
/// Allows `cfg(target(abi = "..."))`.
(unstable, cfg_target_compact, "1.63.0", Some(96901)),
/// Allows `cfg(target_has_atomic_load_store = "...")`.

View File

@ -8,8 +8,7 @@ pub fn target() -> Target {
arch: "arm".into(),
options: TargetOptions {
abi: "eabihf".into(),
// FIXME: change env to "gnu" when cfg_target_abi becomes stable
env: "gnueabihf".into(),
env: "gnu".into(),
features: "+v6,+vfp2,-d32".into(),
max_atomic_width: Some(64),
mcount: "\u{1}__gnu_mcount_nc".into(),

View File

@ -8,8 +8,6 @@ pub fn target() -> Target {
arch: "arm".into(),
options: TargetOptions {
abi: "eabihf".into(),
// FIXME: remove env when cfg_target_abi becomes stable
env: "eabihf".into(),
features: "+v6,+vfp2,-d32".into(),
max_atomic_width: Some(64),
mcount: "__mcount".into(),

View File

@ -8,8 +8,7 @@ pub fn target() -> Target {
arch: "arm".into(),
options: TargetOptions {
abi: "eabihf".into(),
// FIXME: change env to "gnu" when cfg_target_abi becomes stable
env: "gnueabihf".into(),
env: "gnu".into(),
features: "+v7,+vfp3,-d32,+thumb2,-neon".into(),
max_atomic_width: Some(64),
mcount: "\u{1}__gnu_mcount_nc".into(),

View File

@ -8,8 +8,6 @@ pub fn target() -> Target {
arch: "arm".into(),
options: TargetOptions {
abi: "eabihf".into(),
// FIXME: remove env when cfg_target_abi becomes stable
env: "eabihf".into(),
features: "+v7,+vfp3,-d32,+thumb2,-neon".into(),
max_atomic_width: Some(64),
mcount: "__mcount".into(),

View File

@ -3,7 +3,7 @@
#![feature(link_cfg)]
#![feature(staged_api)]
#![feature(c_unwind)]
#![feature(cfg_target_abi)]
#![cfg_attr(bootstrap, feature(cfg_target_abi))]
#![feature(strict_provenance)]
#![cfg_attr(not(target_env = "msvc"), feature(libc))]
#![allow(internal_features)]

View File

@ -1,5 +1,4 @@
//@ run-pass
#![feature(cfg_target_abi)]
#[cfg(target_abi = "eabihf")]
pub fn main() {

View File

@ -10,7 +10,6 @@
#![feature(cfg_overflow_checks)]
#![feature(cfg_relocation_model)]
#![feature(cfg_sanitize)]
#![feature(cfg_target_abi)]
#![feature(cfg_target_has_atomic)]
#![feature(cfg_target_has_atomic_equal_alignment)]
#![feature(cfg_target_thread_local)]

View File

@ -1,5 +1,5 @@
warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE`
--> $DIR/well-known-values.rs:26:5
--> $DIR/well-known-values.rs:25:5
|
LL | clippy = "_UNEXPECTED_VALUE",
| ^^^^^^----------------------
@ -11,7 +11,7 @@ LL | clippy = "_UNEXPECTED_VALUE",
= note: `#[warn(unexpected_cfgs)]` on by default
warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE`
--> $DIR/well-known-values.rs:28:5
--> $DIR/well-known-values.rs:27:5
|
LL | debug_assertions = "_UNEXPECTED_VALUE",
| ^^^^^^^^^^^^^^^^----------------------
@ -22,7 +22,7 @@ LL | debug_assertions = "_UNEXPECTED_VALUE",
= note: see <https://doc.rust-lang.org/nightly/unstable-book/compiler-flags/check-cfg.html> for more information about checking conditional configuration
warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE`
--> $DIR/well-known-values.rs:30:5
--> $DIR/well-known-values.rs:29:5
|
LL | doc = "_UNEXPECTED_VALUE",
| ^^^----------------------
@ -33,7 +33,7 @@ LL | doc = "_UNEXPECTED_VALUE",
= note: see <https://doc.rust-lang.org/nightly/unstable-book/compiler-flags/check-cfg.html> for more information about checking conditional configuration
warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE`
--> $DIR/well-known-values.rs:32:5
--> $DIR/well-known-values.rs:31:5
|
LL | doctest = "_UNEXPECTED_VALUE",
| ^^^^^^^----------------------
@ -44,7 +44,7 @@ LL | doctest = "_UNEXPECTED_VALUE",
= note: see <https://doc.rust-lang.org/nightly/unstable-book/compiler-flags/check-cfg.html> for more information about checking conditional configuration
warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE`
--> $DIR/well-known-values.rs:34:5
--> $DIR/well-known-values.rs:33:5
|
LL | miri = "_UNEXPECTED_VALUE",
| ^^^^----------------------
@ -55,7 +55,7 @@ LL | miri = "_UNEXPECTED_VALUE",
= note: see <https://doc.rust-lang.org/nightly/unstable-book/compiler-flags/check-cfg.html> for more information about checking conditional configuration
warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE`
--> $DIR/well-known-values.rs:36:5
--> $DIR/well-known-values.rs:35:5
|
LL | overflow_checks = "_UNEXPECTED_VALUE",
| ^^^^^^^^^^^^^^^----------------------
@ -66,7 +66,7 @@ LL | overflow_checks = "_UNEXPECTED_VALUE",
= note: see <https://doc.rust-lang.org/nightly/unstable-book/compiler-flags/check-cfg.html> for more information about checking conditional configuration
warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE`
--> $DIR/well-known-values.rs:38:5
--> $DIR/well-known-values.rs:37:5
|
LL | panic = "_UNEXPECTED_VALUE",
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
@ -75,7 +75,7 @@ LL | panic = "_UNEXPECTED_VALUE",
= note: see <https://doc.rust-lang.org/nightly/unstable-book/compiler-flags/check-cfg.html> for more information about checking conditional configuration
warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE`
--> $DIR/well-known-values.rs:40:5
--> $DIR/well-known-values.rs:39:5
|
LL | proc_macro = "_UNEXPECTED_VALUE",
| ^^^^^^^^^^----------------------
@ -86,7 +86,7 @@ LL | proc_macro = "_UNEXPECTED_VALUE",
= note: see <https://doc.rust-lang.org/nightly/unstable-book/compiler-flags/check-cfg.html> for more information about checking conditional configuration
warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE`
--> $DIR/well-known-values.rs:42:5
--> $DIR/well-known-values.rs:41:5
|
LL | relocation_model = "_UNEXPECTED_VALUE",
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@ -95,7 +95,7 @@ LL | relocation_model = "_UNEXPECTED_VALUE",
= note: see <https://doc.rust-lang.org/nightly/unstable-book/compiler-flags/check-cfg.html> for more information about checking conditional configuration
warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE`
--> $DIR/well-known-values.rs:44:5
--> $DIR/well-known-values.rs:43:5
|
LL | sanitize = "_UNEXPECTED_VALUE",
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@ -104,7 +104,7 @@ LL | sanitize = "_UNEXPECTED_VALUE",
= note: see <https://doc.rust-lang.org/nightly/unstable-book/compiler-flags/check-cfg.html> for more information about checking conditional configuration
warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE`
--> $DIR/well-known-values.rs:46:5
--> $DIR/well-known-values.rs:45:5
|
LL | target_abi = "_UNEXPECTED_VALUE",
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@ -113,7 +113,7 @@ LL | target_abi = "_UNEXPECTED_VALUE",
= note: see <https://doc.rust-lang.org/nightly/unstable-book/compiler-flags/check-cfg.html> for more information about checking conditional configuration
warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE`
--> $DIR/well-known-values.rs:48:5
--> $DIR/well-known-values.rs:47:5
|
LL | target_arch = "_UNEXPECTED_VALUE",
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@ -122,7 +122,7 @@ LL | target_arch = "_UNEXPECTED_VALUE",
= note: see <https://doc.rust-lang.org/nightly/unstable-book/compiler-flags/check-cfg.html> for more information about checking conditional configuration
warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE`
--> $DIR/well-known-values.rs:50:5
--> $DIR/well-known-values.rs:49:5
|
LL | target_endian = "_UNEXPECTED_VALUE",
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@ -131,16 +131,16 @@ LL | target_endian = "_UNEXPECTED_VALUE",
= note: see <https://doc.rust-lang.org/nightly/unstable-book/compiler-flags/check-cfg.html> for more information about checking conditional configuration
warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE`
--> $DIR/well-known-values.rs:52:5
--> $DIR/well-known-values.rs:51:5
|
LL | target_env = "_UNEXPECTED_VALUE",
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: expected values for `target_env` are: ``, `eabihf`, `gnu`, `gnueabihf`, `msvc`, `musl`, `newlib`, `nto70`, `nto71`, `ohos`, `psx`, `relibc`, `sgx`, `uclibc`
= note: expected values for `target_env` are: ``, `gnu`, `msvc`, `musl`, `newlib`, `nto70`, `nto71`, `ohos`, `psx`, `relibc`, `sgx`, `uclibc`
= note: see <https://doc.rust-lang.org/nightly/unstable-book/compiler-flags/check-cfg.html> for more information about checking conditional configuration
warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE`
--> $DIR/well-known-values.rs:54:5
--> $DIR/well-known-values.rs:53:5
|
LL | target_family = "_UNEXPECTED_VALUE",
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@ -149,7 +149,7 @@ LL | target_family = "_UNEXPECTED_VALUE",
= note: see <https://doc.rust-lang.org/nightly/unstable-book/compiler-flags/check-cfg.html> for more information about checking conditional configuration
warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE`
--> $DIR/well-known-values.rs:56:5
--> $DIR/well-known-values.rs:55:5
|
LL | target_feature = "_UNEXPECTED_VALUE",
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@ -158,7 +158,7 @@ LL | target_feature = "_UNEXPECTED_VALUE",
= note: see <https://doc.rust-lang.org/nightly/unstable-book/compiler-flags/check-cfg.html> for more information about checking conditional configuration
warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE`
--> $DIR/well-known-values.rs:58:5
--> $DIR/well-known-values.rs:57:5
|
LL | target_has_atomic = "_UNEXPECTED_VALUE",
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@ -167,7 +167,7 @@ LL | target_has_atomic = "_UNEXPECTED_VALUE",
= note: see <https://doc.rust-lang.org/nightly/unstable-book/compiler-flags/check-cfg.html> for more information about checking conditional configuration
warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE`
--> $DIR/well-known-values.rs:60:5
--> $DIR/well-known-values.rs:59:5
|
LL | target_has_atomic_equal_alignment = "_UNEXPECTED_VALUE",
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@ -176,7 +176,7 @@ LL | target_has_atomic_equal_alignment = "_UNEXPECTED_VALUE",
= note: see <https://doc.rust-lang.org/nightly/unstable-book/compiler-flags/check-cfg.html> for more information about checking conditional configuration
warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE`
--> $DIR/well-known-values.rs:62:5
--> $DIR/well-known-values.rs:61:5
|
LL | target_has_atomic_load_store = "_UNEXPECTED_VALUE",
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@ -185,7 +185,7 @@ LL | target_has_atomic_load_store = "_UNEXPECTED_VALUE",
= note: see <https://doc.rust-lang.org/nightly/unstable-book/compiler-flags/check-cfg.html> for more information about checking conditional configuration
warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE`
--> $DIR/well-known-values.rs:64:5
--> $DIR/well-known-values.rs:63:5
|
LL | target_os = "_UNEXPECTED_VALUE",
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@ -194,7 +194,7 @@ LL | target_os = "_UNEXPECTED_VALUE",
= note: see <https://doc.rust-lang.org/nightly/unstable-book/compiler-flags/check-cfg.html> for more information about checking conditional configuration
warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE`
--> $DIR/well-known-values.rs:66:5
--> $DIR/well-known-values.rs:65:5
|
LL | target_pointer_width = "_UNEXPECTED_VALUE",
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@ -203,7 +203,7 @@ LL | target_pointer_width = "_UNEXPECTED_VALUE",
= note: see <https://doc.rust-lang.org/nightly/unstable-book/compiler-flags/check-cfg.html> for more information about checking conditional configuration
warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE`
--> $DIR/well-known-values.rs:68:5
--> $DIR/well-known-values.rs:67:5
|
LL | target_thread_local = "_UNEXPECTED_VALUE",
| ^^^^^^^^^^^^^^^^^^^----------------------
@ -214,7 +214,7 @@ LL | target_thread_local = "_UNEXPECTED_VALUE",
= note: see <https://doc.rust-lang.org/nightly/unstable-book/compiler-flags/check-cfg.html> for more information about checking conditional configuration
warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE`
--> $DIR/well-known-values.rs:70:5
--> $DIR/well-known-values.rs:69:5
|
LL | target_vendor = "_UNEXPECTED_VALUE",
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@ -223,7 +223,7 @@ LL | target_vendor = "_UNEXPECTED_VALUE",
= note: see <https://doc.rust-lang.org/nightly/unstable-book/compiler-flags/check-cfg.html> for more information about checking conditional configuration
warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE`
--> $DIR/well-known-values.rs:72:5
--> $DIR/well-known-values.rs:71:5
|
LL | test = "_UNEXPECTED_VALUE",
| ^^^^----------------------
@ -234,7 +234,7 @@ LL | test = "_UNEXPECTED_VALUE",
= note: see <https://doc.rust-lang.org/nightly/unstable-book/compiler-flags/check-cfg.html> for more information about checking conditional configuration
warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE`
--> $DIR/well-known-values.rs:74:5
--> $DIR/well-known-values.rs:73:5
|
LL | unix = "_UNEXPECTED_VALUE",
| ^^^^----------------------
@ -245,7 +245,7 @@ LL | unix = "_UNEXPECTED_VALUE",
= note: see <https://doc.rust-lang.org/nightly/unstable-book/compiler-flags/check-cfg.html> for more information about checking conditional configuration
warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE`
--> $DIR/well-known-values.rs:76:5
--> $DIR/well-known-values.rs:75:5
|
LL | windows = "_UNEXPECTED_VALUE",
| ^^^^^^^----------------------
@ -256,7 +256,7 @@ LL | windows = "_UNEXPECTED_VALUE",
= note: see <https://doc.rust-lang.org/nightly/unstable-book/compiler-flags/check-cfg.html> for more information about checking conditional configuration
warning: unexpected `cfg` condition value: `linuz`
--> $DIR/well-known-values.rs:82:7
--> $DIR/well-known-values.rs:81:7
|
LL | #[cfg(target_os = "linuz")] // testing that we suggest `linux`
| ^^^^^^^^^^^^-------

View File

@ -1,13 +0,0 @@
#[cfg(target_abi = "x")] //~ ERROR `cfg(target_abi)` is experimental
struct Foo(u64, u64);
#[cfg_attr(target_abi = "x", x)] //~ ERROR `cfg(target_abi)` is experimental
struct Bar(u64, u64);
#[cfg(not(any(all(target_abi = "x"))))] //~ ERROR `cfg(target_abi)` is experimental
fn foo() {}
fn main() {
cfg!(target_abi = "x");
//~^ ERROR `cfg(target_abi)` is experimental and subject to change
}

View File

@ -1,43 +0,0 @@
error[E0658]: `cfg(target_abi)` is experimental and subject to change
--> $DIR/feature-gate-cfg-target-abi.rs:1:7
|
LL | #[cfg(target_abi = "x")]
| ^^^^^^^^^^^^^^^^
|
= note: see issue #80970 <https://github.com/rust-lang/rust/issues/80970> for more information
= help: add `#![feature(cfg_target_abi)]` 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]: `cfg(target_abi)` is experimental and subject to change
--> $DIR/feature-gate-cfg-target-abi.rs:4:12
|
LL | #[cfg_attr(target_abi = "x", x)]
| ^^^^^^^^^^^^^^^^
|
= note: see issue #80970 <https://github.com/rust-lang/rust/issues/80970> for more information
= help: add `#![feature(cfg_target_abi)]` 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]: `cfg(target_abi)` is experimental and subject to change
--> $DIR/feature-gate-cfg-target-abi.rs:7:19
|
LL | #[cfg(not(any(all(target_abi = "x"))))]
| ^^^^^^^^^^^^^^^^
|
= note: see issue #80970 <https://github.com/rust-lang/rust/issues/80970> for more information
= help: add `#![feature(cfg_target_abi)]` 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]: `cfg(target_abi)` is experimental and subject to change
--> $DIR/feature-gate-cfg-target-abi.rs:11:10
|
LL | cfg!(target_abi = "x");
| ^^^^^^^^^^^^^^^^
|
= note: see issue #80970 <https://github.com/rust-lang/rust/issues/80970> for more information
= help: add `#![feature(cfg_target_abi)]` 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 4 previous errors
For more information about this error, try `rustc --explain E0658`.