Skip to content

Commit b8a3c10

Browse files
committed
Add cfg.cfg_attr.attr-restriction
This puts this particular restriction into a dedicated rule since it is unrelated to the previous sentence.
1 parent 3089d61 commit b8a3c10

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/conditional-compilation.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -415,6 +415,8 @@ Multiple `cfg_attr` attributes may be specified.
415415

416416
r[cfg.cfg_attr.behaviour]
417417
When the configuration predicate is true, this attribute expands out to the attributes listed after the predicate. For example, the following module will either be found at `linux.rs` or `windows.rs` based on the target.
418+
r[cfg.cfg_attr.attr-restriction]
419+
The [`crate_type`] and [`crate_name`] attributes cannot be used with `cfg_attr`.
418420

419421

420422
r[cfg.cfg_attr.attribute-list]
@@ -434,8 +436,6 @@ fn bewitched() {}
434436
> [!NOTE]
435437
> The `cfg_attr` can expand to another `cfg_attr`. For example, `#[cfg_attr(target_os = "linux", cfg_attr(feature = "multithreaded", some_other_attribute))]` is valid. This example would be equivalent to `#[cfg_attr(all(target_os = "linux", feature ="multithreaded"), some_other_attribute)]`.
436438
437-
The [`crate_type`] and [`crate_name`] attributes cannot be used with `cfg_attr`.
438-
439439
r[cfg.macro]
440440
### The `cfg` macro
441441

0 commit comments

Comments
 (0)