Skip to content

Commit 00a8d65

Browse files
committed
document missing attributes in the reference
Fixes #24406
1 parent 3908bae commit 00a8d65

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

src/doc/reference.md

+11-1
Original file line numberDiff line numberDiff line change
@@ -2177,6 +2177,14 @@ The following configurations must be defined by the implementation:
21772177
* `unix`. See `target_family`.
21782178
* `windows`. See `target_family`.
21792179

2180+
You can also set another attribute based on a `cfg` variable with `cfg_attr`:
2181+
2182+
```rust,ignore
2183+
#[cfg_attr(a, b)]
2184+
```
2185+
2186+
Will be the same as `#[b]` if `a` is set by `cfg`, and nothing otherwise.
2187+
21802188
### Lint check attributes
21812189

21822190
A lint check names a potentially undesirable coding pattern, such as
@@ -2444,7 +2452,9 @@ The currently implemented features of the reference compiler are:
24442452
* `simd_ffi` - Allows use of SIMD vectors in signatures for foreign functions.
24452453
The SIMD interface is subject to change.
24462454

2447-
* `staged_api` - Allows usage of stability markers and `#![staged_api]` in a crate
2455+
* `staged_api` - Allows usage of stability markers and `#![staged_api]` in a
2456+
crate. Stability markers are also attributes: `#[stable]`,
2457+
`#[unstable]`, and `#[deprecated]` are the three levels.
24482458

24492459
* `static_assert` - The `#[static_assert]` functionality is experimental and
24502460
unstable. The attribute can be attached to a `static` of

0 commit comments

Comments
 (0)