Skip to content

Commit d92431b

Browse files
committed
Add cfg.attr.duplicates
1 parent c9a9bcf commit d92431b

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/conditional-compilation.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -367,14 +367,15 @@ The syntax for the `cfg` attribute is:
367367
r[cfg.attr.allowed-positions]
368368
The `cfg` attribute is allowed anywhere attributes are allowed.
369369

370+
r[cfg.attr.duplicates]
371+
Multiple `cfg` attributes may be specified. The thing will not be included if any of the `cfg` predicates are false.
372+
370373
r[cfg.attr.effect]
371374
If the predicate is true, the thing is rewritten to not have the `cfg` attribute on it. If the predicate is false, the thing is removed from the source code.
372375

373376
r[cfg.attr.crate-level-attrs]
374377
When a crate-level `cfg` has a false predicate, the behavior is slightly different: any crate attributes preceding the `cfg` are kept, and any crate attributes following the `cfg` are removed. This allows `#![no_std]` and `#![no_core]` crates to avoid linking `std`/`core` even if a `#![cfg(...)]` has removed the entire crate.
375378

376-
377-
378379
r[cfg.cfg_attr]
379380
### The `cfg_attr` attribute
380381

0 commit comments

Comments
 (0)