You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In most of the examples for these attributes, there's no lead-in, so
let's remove the lead-in here.
Let's also say "form" rather than "thing", even though "thing" does
have a certain appeal to it.
In our rule for duplicates, let's add a forward reference to the
exception to that.
Finally, we say that the attribute applied at the crate level does not
remove the crate; later, for an example, let's clarify that it only
removes the content of the crate.
Most or all of this was preexisting to this PR.
The `cfg` attribute is allowed anywhere attributes are allowed.
369
367
370
368
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.
369
+
Multiple `cfg` attributes may be specified. The form to which the attribute is attached will not be included if any of the `cfg` predicates are false except as described in [cfg.attr.crate-level-attrs].
372
370
373
371
r[cfg.attr.effect]
374
-
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.
372
+
If the predicate is true, the form is rewritten to not have the `cfg` attribute on it. If the predicate is false, the form is removed from the source code.
375
373
376
374
r[cfg.attr.crate-level-attrs]
377
375
When a crate-level `cfg` has a false predicate, the crate itself still exists. Any crate attributes preceding the `cfg` are kept, and any crate attributes following the `cfg` are removed as well as removing all of the following crate contents.
378
376
379
377
> [!EXAMPLE]
380
-
> The behavior of not removing the preceding attributes allows you to do things such as include `#![no_std]` to avoid linking `std` even if a `#![cfg(...)]` has removed the entire crate. For example:
378
+
> The behavior of not removing the preceding attributes allows you to do things such as include `#![no_std]` to avoid linking `std` even if a `#![cfg(...)]` has otherwise removed the contents of the crate. For example:
381
379
>
382
380
> <!-- ignore: test infrastructure can't handle no_std -->
0 commit comments