Skip to content

Commit 2766ec3

Browse files
committed
Add restriction for cfg_attr with crate_type and crate_name
1 parent c64e52a commit 2766ec3

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/conditional-compilation.md

+4
Original file line numberDiff line numberDiff line change
@@ -339,6 +339,8 @@ fn bewitched() {}
339339
340340
The `cfg_attr` attribute is allowed anywhere attributes are allowed.
341341

342+
The [`crate_type`] and [`crate_name`] attributes cannot be used with `cfg_attr`.
343+
342344
### The `cfg` macro
343345

344346
The built-in `cfg` macro takes in a single configuration predicate and evaluates
@@ -369,6 +371,8 @@ println!("I'm running on a {} machine!", machine_kind);
369371
[`cfg`]: #the-cfg-attribute
370372
[`cfg` macro]: #the-cfg-macro
371373
[`cfg_attr`]: #the-cfg_attr-attribute
374+
[`crate_name`]: crates-and-source-files.md#the-crate_name-attribute
375+
[`crate_type`]: linkage.md
372376
[`target_feature` attribute]: attributes/codegen.md#the-target_feature-attribute
373377
[attribute]: attributes.md
374378
[attributes]: attributes.md

0 commit comments

Comments
 (0)