diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/test/ui/cfg/cfg-target-abi.rs | 10 | ||||
| -rw-r--r-- | src/test/ui/feature-gates/feature-gate-cfg-target-abi.rs | 11 | ||||
| -rw-r--r-- | src/test/ui/feature-gates/feature-gate-cfg-target-abi.stderr | 39 | ||||
| -rw-r--r-- | src/tools/tidy/src/pal.rs | 1 |
4 files changed, 61 insertions, 0 deletions
diff --git a/src/test/ui/cfg/cfg-target-abi.rs b/src/test/ui/cfg/cfg-target-abi.rs new file mode 100644 index 00000000000..acc570fc843 --- /dev/null +++ b/src/test/ui/cfg/cfg-target-abi.rs @@ -0,0 +1,10 @@ +// run-pass +#![feature(cfg_target_abi)] + +#[cfg(target_abi = "eabihf")] +pub fn main() { +} + +#[cfg(not(target_abi = "eabihf"))] +pub fn main() { +} diff --git a/src/test/ui/feature-gates/feature-gate-cfg-target-abi.rs b/src/test/ui/feature-gates/feature-gate-cfg-target-abi.rs new file mode 100644 index 00000000000..f2651493980 --- /dev/null +++ b/src/test/ui/feature-gates/feature-gate-cfg-target-abi.rs @@ -0,0 +1,11 @@ +#[cfg(target_abi = "x")] //~ ERROR `cfg(target_abi)` is experimental +#[cfg_attr(target_abi = "x", x)] //~ ERROR `cfg(target_abi)` is experimental +struct Foo(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 +} diff --git a/src/test/ui/feature-gates/feature-gate-cfg-target-abi.stderr b/src/test/ui/feature-gates/feature-gate-cfg-target-abi.stderr new file mode 100644 index 00000000000..ed8cbcbe4f0 --- /dev/null +++ b/src/test/ui/feature-gates/feature-gate-cfg-target-abi.stderr @@ -0,0 +1,39 @@ +error[E0658]: `cfg(target_abi)` is experimental and subject to change + --> $DIR/feature-gate-cfg-target-abi.rs:2: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 + +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 + +error[E0658]: `cfg(target_abi)` is experimental and subject to change + --> $DIR/feature-gate-cfg-target-abi.rs:5: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 + +error[E0658]: `cfg(target_abi)` is experimental and subject to change + --> $DIR/feature-gate-cfg-target-abi.rs:9: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 + +error: aborting due to 4 previous errors + +For more information about this error, try `rustc --explain E0658`. diff --git a/src/tools/tidy/src/pal.rs b/src/tools/tidy/src/pal.rs index 31cdc6865a4..24a10018779 100644 --- a/src/tools/tidy/src/pal.rs +++ b/src/tools/tidy/src/pal.rs @@ -122,6 +122,7 @@ fn check_cfgs( let contains_platform_specific_cfg = cfg.contains("target_os") || cfg.contains("target_env") + || cfg.contains("target_abi") || cfg.contains("target_vendor") || cfg.contains("unix") || cfg.contains("windows"); |
