Skip to content

Commit 0e66ad6

Browse files
authored
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](rust-lang/rfcs#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](rust-lang/rust#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.
2 parents 2ad5ffe + 546766f commit 0e66ad6

File tree

1 file changed

+0
-29
lines changed

1 file changed

+0
-29
lines changed

crates/ide-db/src/generated/lints.rs

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -3789,35 +3789,6 @@ The tracking issue for this feature is: [#64797]
37893789
[#64797]: https://github.com/rust-lang/rust/issues/64797
37903790

37913791
------------------------
3792-
"##,
3793-
default_severity: Severity::Allow,
3794-
warn_since: None,
3795-
deny_since: None,
3796-
},
3797-
Lint {
3798-
label: "cfg_boolean_literals",
3799-
description: r##"# `cfg_boolean_literals`
3800-
3801-
The tracking issue for this feature is: [#131204]
3802-
3803-
[#131204]: https://github.com/rust-lang/rust/issues/131204
3804-
3805-
------------------------
3806-
3807-
The `cfg_boolean_literals` feature makes it possible to use the `true`/`false`
3808-
literal as cfg predicate. They always evaluate to true/false respectively.
3809-
3810-
## Examples
3811-
3812-
```rust
3813-
#![feature(cfg_boolean_literals)]
3814-
3815-
#[cfg(true)]
3816-
const A: i32 = 5;
3817-
3818-
#[cfg(all(false))]
3819-
const A: i32 = 58 * 89;
3820-
```
38213792
"##,
38223793
default_severity: Severity::Allow,
38233794
warn_since: None,

0 commit comments

Comments
 (0)