diff options
| author | Urgau <urgau@numericable.fr> | 2024-09-19 11:19:35 +0200 |
|---|---|---|
| committer | Urgau <urgau@numericable.fr> | 2024-10-04 09:09:20 +0200 |
| commit | 62ef411631efb25134e29da76fcdb7802aa94bd4 (patch) | |
| tree | 52298c664f291f37a910d8a0c2e10b1e062314f5 /src/doc | |
| parent | c99f29b29fa4115436c352a921f9963b173b5608 (diff) | |
| download | rust-62ef411631efb25134e29da76fcdb7802aa94bd4.tar.gz rust-62ef411631efb25134e29da76fcdb7802aa94bd4.zip | |
Feature gate boolean lit support in cfg predicates
Diffstat (limited to 'src/doc')
| -rw-r--r-- | src/doc/unstable-book/src/language-features/cfg-boolean-literals.md | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/doc/unstable-book/src/language-features/cfg-boolean-literals.md b/src/doc/unstable-book/src/language-features/cfg-boolean-literals.md new file mode 100644 index 00000000000..ad795ff9d9b --- /dev/null +++ b/src/doc/unstable-book/src/language-features/cfg-boolean-literals.md @@ -0,0 +1,22 @@ +# `cfg_boolean_literals` + +The tracking issue for this feature is: [#131204] + +[#131204]: https://github.com/rust-lang/rust/issues/131204 + +------------------------ + +The `cfg_boolean_literals` feature makes it possible to use the `true`/`false` +literal as cfg predicate. They always evaluate to true/false respectively. + +## Examples + +```rust +#![feature(cfg_boolean_literals)] + +#[cfg(true)] +const A: i32 = 5; + +#[cfg(all(false))] +const A: i32 = 58 * 89; +``` |
