about summary refs log tree commit diff
path: root/tests/ui/rfcs
diff options
context:
space:
mode:
authorMatthias Krüger <476013+matthiaskrgr@users.noreply.github.com>2025-04-17 06:25:15 +0200
committerGitHub <noreply@github.com>2025-04-17 06:25:15 +0200
commit0de803c38d33655ed3ec25e237b6c1e2bb4e7426 (patch)
treefd038b26e48061badb25e3accb29b54cb77fabd5 /tests/ui/rfcs
parent3920514036f59b5596133707a425f1b8a1c20815 (diff)
parent303c1b45c29f8bb186a9a95cb56643d1aef773fa (diff)
downloadrust-0de803c38d33655ed3ec25e237b6c1e2bb4e7426.tar.gz
rust-0de803c38d33655ed3ec25e237b6c1e2bb4e7426.zip
Rollup merge of #138632 - clubby789:stabilize-cfg-boolean-lit, r=davidtwco,Urgau,traviscross
Stabilize `cfg_boolean_literals`

Closes #131204
`@rustbot` labels +T-lang +I-lang-nominated
This will end up conflicting with the test in #138293 so whichever doesn't land first will need updating

--

# Stabilization Report

## General design

### What is the RFC for this feature and what changes have occurred to the user-facing design since the RFC was finalized?

[RFC 3695](https://github.com/rust-lang/rfcs/pull/3695), none.

### What behavior are we committing to that has been controversial? Summarize the major arguments pro/con.

None

### Are there extensions to this feature that remain unstable? How do we know that we are not accidentally committing to those?

None

## Has a call-for-testing period been conducted? If so, what feedback was received?

Yes; only positive feedback was received.

## Implementation quality

### Summarize the major parts of the implementation and provide links into the code (or to PRs)

Implemented in [#131034](https://github.com/rust-lang/rust/pull/131034).

### Summarize existing test coverage of this feature

- [Basic usage, including `#[cfg()]`, `cfg!()` and `#[cfg_attr()]`](https://github.com/rust-lang/rust/blob/6d71251cf9e40326461f90f8ff9a7024706aea87/tests/ui/cfg/true-false.rs)
- [`--cfg=true/false` on the command line being accessible via `r#true/r#false`](https://github.com/rust-lang/rust/blob/6d71251cf9e40326461f90f8ff9a7024706aea87/tests/ui/cfg/raw-true-false.rs)
- [Interaction with the unstable `#[doc(cfg(..))]` feature](https://github.com/rust-lang/rust/tree/6d71251/tests/rustdoc-ui/cfg-boolean-literal.rs)
- [Denying `--check-cfg=cfg(true/false)`](https://github.com/rust-lang/rust/tree/6d71251/tests/ui/check-cfg/invalid-arguments.rs)
- Ensuring `--cfg false` on the command line doesn't change the meaning of `cfg(false)`: `tests/ui/cfg/cmdline-false.rs`
- Ensuring both `cfg(true)` and `cfg(false)` on the same item result in it being disabled: `tests/ui/cfg/both-true-false.rs`

### What outstanding bugs in the issue tracker involve this feature? Are they stabilization-blocking?

The above mentioned issue; it should not block as it interacts with another unstable feature.

### What FIXMEs are still in the code for that feature and why is it ok to leave them there?

None

### Summarize contributors to the feature by name for recognition and assuredness that people involved in the feature agree with stabilization
- `@clubby789` (RFC)
- `@Urgau` (Implementation in rustc)

### Which tools need to be adjusted to support this feature. Has this work been done?

`rustdoc`'s  unstable`#[doc(cfg(..)]` has been updated to respect it. `cargo` has been updated with a forward compatibility lint to enable supporting it in cargo once stabilized.

## Type system and execution rules

### What updates are needed to the reference/specification? (link to PRs when they exist)

A few lines to be added to the reference for configuration predicates, specified in the RFC.
Diffstat (limited to 'tests/ui/rfcs')
-rw-r--r--tests/ui/rfcs/rfc-2294-if-let-guard/feature-gate.rs2
-rw-r--r--tests/ui/rfcs/rfc-2294-if-let-guard/parens.rs2
-rw-r--r--tests/ui/rfcs/rfc-2497-if-let-chains/disallowed-positions.rs8
-rw-r--r--tests/ui/rfcs/rfc-2497-if-let-chains/feature-gate.rs2
-rw-r--r--tests/ui/rfcs/rfc-2497-if-let-chains/feature-gate.stderr2
-rw-r--r--tests/ui/rfcs/rfc-2497-if-let-chains/invalid-let-in-a-valid-let-context.rs10
-rw-r--r--tests/ui/rfcs/rfc-2565-param-attrs/attr-without-param.rs6
7 files changed, 16 insertions, 16 deletions
diff --git a/tests/ui/rfcs/rfc-2294-if-let-guard/feature-gate.rs b/tests/ui/rfcs/rfc-2294-if-let-guard/feature-gate.rs
index 110c03d0e54..983fe87451f 100644
--- a/tests/ui/rfcs/rfc-2294-if-let-guard/feature-gate.rs
+++ b/tests/ui/rfcs/rfc-2294-if-let-guard/feature-gate.rs
@@ -64,7 +64,7 @@ fn _macros() {
     //~^ ERROR expected expression, found `let` statement
     //~| ERROR expected expression, found `let` statement
     match () {
-        #[cfg(FALSE)]
+        #[cfg(false)]
         () if let 0 = 1 => {}
         //~^ ERROR `if let` guards are experimental
         _ => {}
diff --git a/tests/ui/rfcs/rfc-2294-if-let-guard/parens.rs b/tests/ui/rfcs/rfc-2294-if-let-guard/parens.rs
index f12824db9c0..0e71a9d24c9 100644
--- a/tests/ui/rfcs/rfc-2294-if-let-guard/parens.rs
+++ b/tests/ui/rfcs/rfc-2294-if-let-guard/parens.rs
@@ -3,7 +3,7 @@
 #![feature(if_let_guard)]
 #![feature(let_chains)]
 
-#[cfg(FALSE)]
+#[cfg(false)]
 fn un_cfged() {
     match () {
         () if let 0 = 1 => {}
diff --git a/tests/ui/rfcs/rfc-2497-if-let-chains/disallowed-positions.rs b/tests/ui/rfcs/rfc-2497-if-let-chains/disallowed-positions.rs
index 99f99c2be72..0b0abe6ec17 100644
--- a/tests/ui/rfcs/rfc-2497-if-let-chains/disallowed-positions.rs
+++ b/tests/ui/rfcs/rfc-2497-if-let-chains/disallowed-positions.rs
@@ -340,12 +340,12 @@ fn outside_if_and_while_expr() {
     //~| ERROR expected expression, found `let` statement
 
     {
-        #[cfg(FALSE)]
+        #[cfg(false)]
         let x = true && let y = 1;
         //~^ ERROR expected expression, found `let` statement
     }
 
-    #[cfg(FALSE)]
+    #[cfg(false)]
     {
         [1, 2, 3][let _ = ()]
         //~^ ERROR expected expression, found `let` statement
@@ -436,11 +436,11 @@ fn with_parenthesis() {
     //[no_feature]~^ ERROR `let` expressions in this position are unstable
     }
 
-    #[cfg(FALSE)]
+    #[cfg(false)]
     let x = (true && let y = 1);
     //~^ ERROR expected expression, found `let` statement
 
-    #[cfg(FALSE)]
+    #[cfg(false)]
     {
         ([1, 2, 3][let _ = ()])
         //~^ ERROR expected expression, found `let` statement
diff --git a/tests/ui/rfcs/rfc-2497-if-let-chains/feature-gate.rs b/tests/ui/rfcs/rfc-2497-if-let-chains/feature-gate.rs
index 2087fc42cf1..dad02b7f106 100644
--- a/tests/ui/rfcs/rfc-2497-if-let-chains/feature-gate.rs
+++ b/tests/ui/rfcs/rfc-2497-if-let-chains/feature-gate.rs
@@ -51,7 +51,7 @@ fn _macros() {
             while $e {}
         }
     }
-    #[cfg(FALSE)] (let 0 = 1);
+    #[cfg(false)] (let 0 = 1);
     //~^ ERROR expected expression, found `let` statement
     use_expr!(let 0 = 1);
     //~^ ERROR no rules expected keyword `let`
diff --git a/tests/ui/rfcs/rfc-2497-if-let-chains/feature-gate.stderr b/tests/ui/rfcs/rfc-2497-if-let-chains/feature-gate.stderr
index 7c874ae78a8..b9dac472dca 100644
--- a/tests/ui/rfcs/rfc-2497-if-let-chains/feature-gate.stderr
+++ b/tests/ui/rfcs/rfc-2497-if-let-chains/feature-gate.stderr
@@ -1,7 +1,7 @@
 error: expected expression, found `let` statement
   --> $DIR/feature-gate.rs:54:20
    |
-LL |     #[cfg(FALSE)] (let 0 = 1);
+LL |     #[cfg(false)] (let 0 = 1);
    |                    ^^^
    |
    = note: only supported directly in conditions of `if` and `while` expressions
diff --git a/tests/ui/rfcs/rfc-2497-if-let-chains/invalid-let-in-a-valid-let-context.rs b/tests/ui/rfcs/rfc-2497-if-let-chains/invalid-let-in-a-valid-let-context.rs
index dce1c19ff33..ae525aed414 100644
--- a/tests/ui/rfcs/rfc-2497-if-let-chains/invalid-let-in-a-valid-let-context.rs
+++ b/tests/ui/rfcs/rfc-2497-if-let-chains/invalid-let-in-a-valid-let-context.rs
@@ -3,12 +3,12 @@
 fn main() {
     let _opt = Some(1i32);
 
-    #[cfg(FALSE)]
+    #[cfg(false)]
     {
         let _ = &&let Some(x) = Some(42);
         //~^ ERROR expected expression, found `let` statement
     }
-    #[cfg(FALSE)]
+    #[cfg(false)]
     {
         if let Some(elem) = _opt && [1, 2, 3][let _ = &&let Some(x) = Some(42)] = 1 {
         //~^ ERROR expected expression, found `let` statement
@@ -18,7 +18,7 @@ fn main() {
         }
     }
 
-    #[cfg(FALSE)]
+    #[cfg(false)]
     {
         if let Some(elem) = _opt && {
             [1, 2, 3][let _ = ()];
@@ -28,7 +28,7 @@ fn main() {
         }
     }
 
-    #[cfg(FALSE)]
+    #[cfg(false)]
     {
         if let Some(elem) = _opt && [1, 2, 3][let _ = ()] = 1 {
         //~^ ERROR expected expression, found `let` statement
@@ -36,7 +36,7 @@ fn main() {
             true
         }
     }
-    #[cfg(FALSE)]
+    #[cfg(false)]
     {
         if let a = 1 && {
             let x = let y = 1;
diff --git a/tests/ui/rfcs/rfc-2565-param-attrs/attr-without-param.rs b/tests/ui/rfcs/rfc-2565-param-attrs/attr-without-param.rs
index eeb2191bab4..c0f17570673 100644
--- a/tests/ui/rfcs/rfc-2565-param-attrs/attr-without-param.rs
+++ b/tests/ui/rfcs/rfc-2565-param-attrs/attr-without-param.rs
@@ -1,14 +1,14 @@
-#[cfg(FALSE)]
+#[cfg(false)]
 impl S {
     fn f(#[attr]) {} //~ ERROR expected parameter name, found `)`
 }
 
-#[cfg(FALSE)]
+#[cfg(false)]
 impl T for S {
     fn f(#[attr]) {} //~ ERROR expected parameter name, found `)`
 }
 
-#[cfg(FALSE)]
+#[cfg(false)]
 trait T {
     fn f(#[attr]); //~ ERROR expected argument name, found `)`
 }