diff --git a/compiler/rustc_attr/messages.ftl b/compiler/rustc_attr/messages.ftl index adabf18ca85d6..3bcfc3fae7497 100644 --- a/compiler/rustc_attr/messages.ftl +++ b/compiler/rustc_attr/messages.ftl @@ -104,9 +104,6 @@ attr_unknown_meta_item = attr_unknown_version_literal = unknown version literal format, assuming it refers to a future version -attr_unstable_cfg_target_compact = - compact `cfg(target(..))` is experimental and subject to change - attr_unsupported_literal_cfg_boolean = literal in `cfg` predicate value must be a boolean attr_unsupported_literal_cfg_string = diff --git a/compiler/rustc_attr/src/builtin.rs b/compiler/rustc_attr/src/builtin.rs index c1db4d07dfc86..163f6e9b5a911 100644 --- a/compiler/rustc_attr/src/builtin.rs +++ b/compiler/rustc_attr/src/builtin.rs @@ -20,7 +20,6 @@ use rustc_span::Span; use rustc_span::hygiene::Transparency; use rustc_span::symbol::{Symbol, kw, sym}; -use crate::fluent_generated; use crate::session_diagnostics::{self, IncorrectReprFormatGenericCause}; /// The version placeholder that recently stabilized features contain inside the @@ -709,33 +708,6 @@ pub fn eval_condition( !eval_condition(mi, sess, features, eval) } - sym::target => { - if let Some(features) = features - && !features.cfg_target_compact - { - feature_err( - sess, - sym::cfg_target_compact, - cfg.span, - fluent_generated::attr_unstable_cfg_target_compact, - ) - .emit(); - } - - mis.iter().fold(true, |res, mi| { - let mut mi = mi.meta_item().unwrap().clone(); - if let [seg, ..] = &mut mi.path.segments[..] { - seg.ident.name = Symbol::intern(&format!("target_{}", seg.ident.name)); - } - - res & eval_condition( - &ast::MetaItemInner::MetaItem(mi), - sess, - features, - eval, - ) - }) - } _ => { dcx.emit_err(session_diagnostics::InvalidPredicate { span: cfg.span, diff --git a/compiler/rustc_feature/src/removed.rs b/compiler/rustc_feature/src/removed.rs index 0cd0963d4e328..85324d94f8bb8 100644 --- a/compiler/rustc_feature/src/removed.rs +++ b/compiler/rustc_feature/src/removed.rs @@ -52,6 +52,9 @@ declare_features! ( (removed, box_syntax, "1.70.0", Some(49733), Some("replaced with `#[rustc_box]`")), /// Allows capturing disjoint fields in a closure/coroutine (RFC 2229). (removed, capture_disjoint_fields, "1.49.0", Some(53488), Some("stabilized in Rust 2021")), + /// Allows `cfg(target(abi = "..."))`. + (removed, cfg_target_compact, "CURRENT_RUSTC_VERSION", Some(96901), + Some("removed due to lack of usefulness and users")), /// Allows comparing raw pointers during const eval. (removed, const_compare_raw_pointers, "1.46.0", Some(53020), Some("cannot be allowed in const eval in any meaningful way")), diff --git a/compiler/rustc_feature/src/unstable.rs b/compiler/rustc_feature/src/unstable.rs index 380e36fe40566..455a3fe4072c7 100644 --- a/compiler/rustc_feature/src/unstable.rs +++ b/compiler/rustc_feature/src/unstable.rs @@ -381,8 +381,6 @@ declare_features! ( (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_compact, "1.63.0", Some(96901)), /// Allows `cfg(target_has_atomic_load_store = "...")`. (unstable, cfg_target_has_atomic, "1.60.0", Some(94039)), /// Allows `cfg(target_has_atomic_equal_alignment = "...")`. diff --git a/tests/ui/cfg/cfg-target-compact-errors.rs b/tests/ui/cfg/cfg-target-compact-errors.rs deleted file mode 100644 index daacbb2851d17..0000000000000 --- a/tests/ui/cfg/cfg-target-compact-errors.rs +++ /dev/null @@ -1,17 +0,0 @@ -//@ check-fail - -#![feature(cfg_target_compact)] - -#[cfg(target(o::o))] -//~^ ERROR `cfg` predicate key must be an identifier -fn one() {} - -#[cfg(target(os = 8))] -//~^ ERROR literal in `cfg` predicate value must be a string -fn two() {} - -#[cfg(target(os = "linux", pointer(width = "64")))] -//~^ ERROR invalid predicate `target_pointer` -fn three() {} - -fn main() {} diff --git a/tests/ui/cfg/cfg-target-compact-errors.stderr b/tests/ui/cfg/cfg-target-compact-errors.stderr deleted file mode 100644 index bb858301eb581..0000000000000 --- a/tests/ui/cfg/cfg-target-compact-errors.stderr +++ /dev/null @@ -1,22 +0,0 @@ -error: `cfg` predicate key must be an identifier - --> $DIR/cfg-target-compact-errors.rs:5:14 - | -LL | #[cfg(target(o::o))] - | ^^^^ - -error[E0565]: literal in `cfg` predicate value must be a string - --> $DIR/cfg-target-compact-errors.rs:9:19 - | -LL | #[cfg(target(os = 8))] - | ^ - -error[E0537]: invalid predicate `target_pointer` - --> $DIR/cfg-target-compact-errors.rs:13:28 - | -LL | #[cfg(target(os = "linux", pointer(width = "64")))] - | ^^^^^^^^^^^^^^^^^^^^^ - -error: aborting due to 3 previous errors - -Some errors have detailed explanations: E0537, E0565. -For more information about an error, try `rustc --explain E0537`. diff --git a/tests/ui/cfg/cfg-target-compact.rs b/tests/ui/cfg/cfg-target-compact.rs deleted file mode 100644 index 7698b36333575..0000000000000 --- a/tests/ui/cfg/cfg-target-compact.rs +++ /dev/null @@ -1,10 +0,0 @@ -//@ run-pass -#![feature(cfg_target_compact)] - -#[cfg(target(os = "linux", pointer_width = "64"))] -pub fn main() { -} - -#[cfg(not(target(os = "linux", pointer_width = "64")))] -pub fn main() { -} diff --git a/tests/ui/check-cfg/compact-names.rs b/tests/ui/check-cfg/compact-names.rs deleted file mode 100644 index 931afdf986f4f..0000000000000 --- a/tests/ui/check-cfg/compact-names.rs +++ /dev/null @@ -1,16 +0,0 @@ -// This test check that we correctly emit an warning for compact cfg -// -//@ check-pass -//@ no-auto-check-cfg -//@ compile-flags: --check-cfg=cfg() - -#![feature(cfg_target_compact)] - -#[cfg(target(os = "linux", arch = "arm"))] -pub fn expected() {} - -#[cfg(target(os = "linux", architecture = "arm"))] -//~^ WARNING unexpected `cfg` condition name -pub fn unexpected() {} - -fn main() {} diff --git a/tests/ui/check-cfg/compact-names.stderr b/tests/ui/check-cfg/compact-names.stderr deleted file mode 100644 index 536c992ee92ea..0000000000000 --- a/tests/ui/check-cfg/compact-names.stderr +++ /dev/null @@ -1,13 +0,0 @@ -warning: unexpected `cfg` condition name: `target_architecture` - --> $DIR/compact-names.rs:12:28 - | -LL | #[cfg(target(os = "linux", architecture = "arm"))] - | ^^^^^^^^^^^^^^^^^^^^ - | - = help: expected names are: `clippy`, `debug_assertions`, `doc`, `doctest`, `fmt_debug`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `rustfmt`, `sanitize`, `sanitizer_cfi_generalize_pointers`, `sanitizer_cfi_normalize_integers`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `test`, `ub_checks`, `unix`, and `windows` - = help: to expect this configuration use `--check-cfg=cfg(target_architecture, values("arm"))` - = note: see for more information about checking conditional configuration - = note: `#[warn(unexpected_cfgs)]` on by default - -warning: 1 warning emitted - diff --git a/tests/ui/check-cfg/compact-values.rs b/tests/ui/check-cfg/compact-values.rs deleted file mode 100644 index f13c23f689572..0000000000000 --- a/tests/ui/check-cfg/compact-values.rs +++ /dev/null @@ -1,16 +0,0 @@ -// This test check that we correctly emit an warning for compact cfg -// -//@ check-pass -//@ no-auto-check-cfg -//@ compile-flags: --check-cfg=cfg() - -#![feature(cfg_target_compact)] - -#[cfg(target(os = "linux", arch = "arm"))] -pub fn expected() {} - -#[cfg(target(os = "linux", pointer_width = "X"))] -//~^ WARNING unexpected `cfg` condition value -pub fn unexpected() {} - -fn main() {} diff --git a/tests/ui/check-cfg/compact-values.stderr b/tests/ui/check-cfg/compact-values.stderr deleted file mode 100644 index c8d14f8c02aa5..0000000000000 --- a/tests/ui/check-cfg/compact-values.stderr +++ /dev/null @@ -1,12 +0,0 @@ -warning: unexpected `cfg` condition value: `X` - --> $DIR/compact-values.rs:12:28 - | -LL | #[cfg(target(os = "linux", pointer_width = "X"))] - | ^^^^^^^^^^^^^^^^^^^ - | - = note: expected values for `target_pointer_width` are: `16`, `32`, and `64` - = note: see for more information about checking conditional configuration - = note: `#[warn(unexpected_cfgs)]` on by default - -warning: 1 warning emitted - diff --git a/tests/ui/feature-gates/feature-gate-cfg-target-compact.rs b/tests/ui/feature-gates/feature-gate-cfg-target-compact.rs deleted file mode 100644 index e9dd81cea1bfd..0000000000000 --- a/tests/ui/feature-gates/feature-gate-cfg-target-compact.rs +++ /dev/null @@ -1,13 +0,0 @@ -#[cfg(target(os = "linux"))] //~ ERROR compact `cfg(target(..))` is experimental -struct Foo(u64, u64); - -#[cfg_attr(target(os = "linux"), non_exhaustive)] //~ ERROR compact `cfg(target(..))` is experimental -struct Bar(u64, u64); - -#[cfg(not(any(all(target(os = "linux")))))] //~ ERROR compact `cfg(target(..))` is experimental -fn foo() {} - -fn main() { - cfg!(target(os = "linux")); - //~^ ERROR compact `cfg(target(..))` is experimental and subject to change -} diff --git a/tests/ui/feature-gates/feature-gate-cfg-target-compact.stderr b/tests/ui/feature-gates/feature-gate-cfg-target-compact.stderr deleted file mode 100644 index 75c5ab37a4dce..0000000000000 --- a/tests/ui/feature-gates/feature-gate-cfg-target-compact.stderr +++ /dev/null @@ -1,43 +0,0 @@ -error[E0658]: compact `cfg(target(..))` is experimental and subject to change - --> $DIR/feature-gate-cfg-target-compact.rs:1:7 - | -LL | #[cfg(target(os = "linux"))] - | ^^^^^^^^^^^^^^^^^^^^ - | - = note: see issue #96901 for more information - = help: add `#![feature(cfg_target_compact)]` 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]: compact `cfg(target(..))` is experimental and subject to change - --> $DIR/feature-gate-cfg-target-compact.rs:4:12 - | -LL | #[cfg_attr(target(os = "linux"), non_exhaustive)] - | ^^^^^^^^^^^^^^^^^^^^ - | - = note: see issue #96901 for more information - = help: add `#![feature(cfg_target_compact)]` 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]: compact `cfg(target(..))` is experimental and subject to change - --> $DIR/feature-gate-cfg-target-compact.rs:7:19 - | -LL | #[cfg(not(any(all(target(os = "linux")))))] - | ^^^^^^^^^^^^^^^^^^^^ - | - = note: see issue #96901 for more information - = help: add `#![feature(cfg_target_compact)]` 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]: compact `cfg(target(..))` is experimental and subject to change - --> $DIR/feature-gate-cfg-target-compact.rs:11:10 - | -LL | cfg!(target(os = "linux")); - | ^^^^^^^^^^^^^^^^^^^^ - | - = note: see issue #96901 for more information - = help: add `#![feature(cfg_target_compact)]` 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`.