From ed81578820a8cbb354d55570e8036c16a30f6f1d Mon Sep 17 00:00:00 2001
From: Urgau <urgau@numericable.fr>
Date: Wed, 24 Apr 2024 22:06:54 +0200
Subject: [PATCH] tests/ui: prepare some tests for --check-cfg by default

---
 .../instrument-coverage-off.rs                   | 11 ++++-------
 .../instrument-coverage/instrument-coverage.rs   |  4 ++--
 .../feature-gate-cfg-target-compact.rs           |  8 ++++----
 .../feature-gate-cfg-target-compact.stderr       | 16 ++++++++--------
 tests/ui/instrument-coverage/on-values.rs        |  4 ++--
 tests/ui/issues/issue-11085.rs                   |  7 +++----
 tests/ui/issues/issue-24434.rs                   |  3 +--
 tests/ui/macros/macro-meta-items.rs              |  6 +++---
 tests/ui/macros/syntax-extension-cfg.rs          | 12 ++++++------
 9 files changed, 33 insertions(+), 38 deletions(-)

diff --git a/tests/codegen/instrument-coverage/instrument-coverage-off.rs b/tests/codegen/instrument-coverage/instrument-coverage-off.rs
index fda3c541a25..616e3295e5b 100644
--- a/tests/codegen/instrument-coverage/instrument-coverage-off.rs
+++ b/tests/codegen/instrument-coverage/instrument-coverage-off.rs
@@ -1,22 +1,19 @@
 // Test that `-Cinstrument-coverage=off` does not add coverage instrumentation to LLVM IR.
 
-//@ needs-profiler-support
-//@ revisions: n no off false zero
+//@ revisions: n no off false_ zero
 //@ [n] compile-flags: -Cinstrument-coverage=n
 //@ [no] compile-flags: -Cinstrument-coverage=no
 //@ [off] compile-flags: -Cinstrument-coverage=off
-//@ [false] compile-flags: -Cinstrument-coverage=false
+//@ [false_] compile-flags: -Cinstrument-coverage=false
 //@ [zero] compile-flags: -Cinstrument-coverage=0
 
 // CHECK-NOT: __llvm_profile_filename
 // CHECK-NOT: __llvm_coverage_mapping
 
-#![crate_type="lib"]
+#![crate_type = "lib"]
 
 #[inline(never)]
-fn some_function() {
-
-}
+fn some_function() {}
 
 pub fn some_other_function() {
     some_function();
diff --git a/tests/codegen/instrument-coverage/instrument-coverage.rs b/tests/codegen/instrument-coverage/instrument-coverage.rs
index f7d96ea3467..d638a544d5a 100644
--- a/tests/codegen/instrument-coverage/instrument-coverage.rs
+++ b/tests/codegen/instrument-coverage/instrument-coverage.rs
@@ -1,12 +1,12 @@
 // Test that `-Cinstrument-coverage` creates expected __llvm_profile_filename symbol in LLVM IR.
 
 //@ needs-profiler-support
-//@ revisions: default y yes on true all
+//@ revisions: default y yes on true_ all
 //@ [default] compile-flags: -Cinstrument-coverage
 //@ [y] compile-flags: -Cinstrument-coverage=y
 //@ [yes] compile-flags: -Cinstrument-coverage=yes
 //@ [on] compile-flags: -Cinstrument-coverage=on
-//@ [true] compile-flags: -Cinstrument-coverage=true
+//@ [true_] compile-flags: -Cinstrument-coverage=true
 //@ [all] compile-flags: -Cinstrument-coverage=all
 
 // CHECK: @__llvm_profile_filename = {{.*}}"default_%m_%p.profraw\00"{{.*}}
diff --git a/tests/ui/feature-gates/feature-gate-cfg-target-compact.rs b/tests/ui/feature-gates/feature-gate-cfg-target-compact.rs
index df81b7d2297..e9dd81cea1b 100644
--- a/tests/ui/feature-gates/feature-gate-cfg-target-compact.rs
+++ b/tests/ui/feature-gates/feature-gate-cfg-target-compact.rs
@@ -1,13 +1,13 @@
-#[cfg(target(os = "x"))] //~ ERROR compact `cfg(target(..))` is experimental
+#[cfg(target(os = "linux"))] //~ ERROR compact `cfg(target(..))` is experimental
 struct Foo(u64, u64);
 
-#[cfg_attr(target(os = "x"), x)] //~ ERROR compact `cfg(target(..))` is experimental
+#[cfg_attr(target(os = "linux"), non_exhaustive)] //~ ERROR compact `cfg(target(..))` is experimental
 struct Bar(u64, u64);
 
-#[cfg(not(any(all(target(os = "x")))))] //~ ERROR compact `cfg(target(..))` is experimental
+#[cfg(not(any(all(target(os = "linux")))))] //~ ERROR compact `cfg(target(..))` is experimental
 fn foo() {}
 
 fn main() {
-    cfg!(target(os = "x"));
+    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
index 1fd59651957..75c5ab37a4d 100644
--- a/tests/ui/feature-gates/feature-gate-cfg-target-compact.stderr
+++ b/tests/ui/feature-gates/feature-gate-cfg-target-compact.stderr
@@ -1,8 +1,8 @@
 error[E0658]: compact `cfg(target(..))` is experimental and subject to change
   --> $DIR/feature-gate-cfg-target-compact.rs:1:7
    |
-LL | #[cfg(target(os = "x"))]
-   |       ^^^^^^^^^^^^^^^^
+LL | #[cfg(target(os = "linux"))]
+   |       ^^^^^^^^^^^^^^^^^^^^
    |
    = note: see issue #96901 <https://github.com/rust-lang/rust/issues/96901> for more information
    = help: add `#![feature(cfg_target_compact)]` to the crate attributes to enable
@@ -11,8 +11,8 @@ LL | #[cfg(target(os = "x"))]
 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 = "x"), x)]
-   |            ^^^^^^^^^^^^^^^^
+LL | #[cfg_attr(target(os = "linux"), non_exhaustive)]
+   |            ^^^^^^^^^^^^^^^^^^^^
    |
    = note: see issue #96901 <https://github.com/rust-lang/rust/issues/96901> for more information
    = help: add `#![feature(cfg_target_compact)]` to the crate attributes to enable
@@ -21,8 +21,8 @@ LL | #[cfg_attr(target(os = "x"), x)]
 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 = "x")))))]
-   |                   ^^^^^^^^^^^^^^^^
+LL | #[cfg(not(any(all(target(os = "linux")))))]
+   |                   ^^^^^^^^^^^^^^^^^^^^
    |
    = note: see issue #96901 <https://github.com/rust-lang/rust/issues/96901> for more information
    = help: add `#![feature(cfg_target_compact)]` to the crate attributes to enable
@@ -31,8 +31,8 @@ LL | #[cfg(not(any(all(target(os = "x")))))]
 error[E0658]: compact `cfg(target(..))` is experimental and subject to change
   --> $DIR/feature-gate-cfg-target-compact.rs:11:10
    |
-LL |     cfg!(target(os = "x"));
-   |          ^^^^^^^^^^^^^^^^
+LL |     cfg!(target(os = "linux"));
+   |          ^^^^^^^^^^^^^^^^^^^^
    |
    = note: see issue #96901 <https://github.com/rust-lang/rust/issues/96901> for more information
    = help: add `#![feature(cfg_target_compact)]` to the crate attributes to enable
diff --git a/tests/ui/instrument-coverage/on-values.rs b/tests/ui/instrument-coverage/on-values.rs
index 36643c40525..a6793b2c304 100644
--- a/tests/ui/instrument-coverage/on-values.rs
+++ b/tests/ui/instrument-coverage/on-values.rs
@@ -1,11 +1,11 @@
 //@ check-pass
 //@ needs-profiler-support
-//@ revisions: default y yes on true all
+//@ revisions: default y yes on true_ all
 //@ [default] compile-flags: -Cinstrument-coverage
 //@ [y] compile-flags: -Cinstrument-coverage=y
 //@ [yes] compile-flags: -Cinstrument-coverage=yes
 //@ [on] compile-flags: -Cinstrument-coverage=on
-//@ [true] compile-flags: -Cinstrument-coverage=true
+//@ [true_] compile-flags: -Cinstrument-coverage=true
 //@ [all] compile-flags: -Cinstrument-coverage=all
 
 fn main() {}
diff --git a/tests/ui/issues/issue-11085.rs b/tests/ui/issues/issue-11085.rs
index 300be10226c..f646ba35cbf 100644
--- a/tests/ui/issues/issue-11085.rs
+++ b/tests/ui/issues/issue-11085.rs
@@ -1,9 +1,8 @@
 //@ run-pass
-#![allow(dead_code)]
-//@ compile-flags: --cfg foo
-
 //@ pretty-expanded FIXME #23616
 
+#![allow(dead_code)]
+
 struct Foo {
     #[cfg(FALSE)]
     bar: baz,
@@ -11,7 +10,7 @@ struct Foo {
 }
 
 struct Foo2 {
-    #[cfg(foo)]
+    #[cfg(all())]
     foo: isize,
 }
 
diff --git a/tests/ui/issues/issue-24434.rs b/tests/ui/issues/issue-24434.rs
index 4cf1f8b50f7..991084c2740 100644
--- a/tests/ui/issues/issue-24434.rs
+++ b/tests/ui/issues/issue-24434.rs
@@ -1,7 +1,6 @@
 //@ check-pass
-//@ compile-flags:--cfg set1
 
-#![cfg_attr(set1, feature(rustc_attrs))]
+#![cfg_attr(all(), feature(rustc_attrs))]
 #![rustc_dummy]
 
 fn main() {}
diff --git a/tests/ui/macros/macro-meta-items.rs b/tests/ui/macros/macro-meta-items.rs
index 10c57fba244..d44a3184bc6 100644
--- a/tests/ui/macros/macro-meta-items.rs
+++ b/tests/ui/macros/macro-meta-items.rs
@@ -16,7 +16,7 @@ macro_rules! emit {
 }
 
 // item
-compiles_fine!(bar);
+compiles_fine!(FALSE);
 emit!(foo);
 
 fn foo() {
@@ -25,7 +25,7 @@ fn foo() {
 
 pub fn main() {
     // statement
-    compiles_fine!(baz);
-    emit!(baz);
+    compiles_fine!(FALSE);
+    emit!(FALSE);
     println!("{}", MISTYPED);
 }
diff --git a/tests/ui/macros/syntax-extension-cfg.rs b/tests/ui/macros/syntax-extension-cfg.rs
index 56d869f3dc1..b819e8c33d8 100644
--- a/tests/ui/macros/syntax-extension-cfg.rs
+++ b/tests/ui/macros/syntax-extension-cfg.rs
@@ -14,11 +14,11 @@ pub fn main() {
     if   cfg!(not(all(foo, qux="foo"))) { panic!() }
     if   cfg!(all(not(all(foo, qux="foo")))) { panic!() }
 
-    if cfg!(not_a_cfg) { panic!() }
-    if cfg!(all(not_a_cfg, foo, qux="foo")) { panic!() }
-    if cfg!(all(not_a_cfg, foo, qux="foo")) { panic!() }
-    if ! cfg!(any(not_a_cfg, foo)) { panic!() }
+    if cfg!(FALSE) { panic!() }
+    if cfg!(all(FALSE, foo, qux="foo")) { panic!() }
+    if cfg!(all(FALSE, foo, qux="foo")) { panic!() }
+    if ! cfg!(any(FALSE, foo)) { panic!() }
 
-    if ! cfg!(not(not_a_cfg)) { panic!() }
-    if ! cfg!(all(not(not_a_cfg), foo, qux="foo")) { panic!() }
+    if ! cfg!(not(FALSE)) { panic!() }
+    if ! cfg!(all(not(FALSE), foo, qux="foo")) { panic!() }
 }