Skip to content

Commit f50583b

Browse files
Apply suggestion
Co-authored-by: Josh Triplett <[email protected]>
1 parent 5de55d8 commit f50583b

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

text/0000-cfg-target.md

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ This proposes a new `cfg`: `target`, which matches the entire target triple
1010
string (e.g. `arm-unknown-linux-gnueabihf`). This also adds a `CARGO_CFG_TARGET`
1111
environment variable for parity with other `CARGO_CFG_*` variables.
1212

13+
In addition, this proposes a shorthand `cfg(target(...))` to match multiple
14+
components of a target string at once.
15+
1316
# Motivation
1417
[motivation]: #motivation
1518

@@ -27,8 +30,8 @@ components.
2730
# Guide-level explanation
2831
[guide-level-explanation]: #guide-level-explanation
2932

30-
This would act like existing `target_*` configurations but match against all
31-
components (except `target_feature`).
33+
This would act like existing `target_*` configurations (except `target_feature`)
34+
but match against all components.
3235

3336
```rust
3437
#[cfg(target = "x86_64-apple-ios-macabi")]
@@ -61,6 +64,12 @@ Example values:
6164
- `"x86_64-pc-windows-msvc"`
6265
- `"x86_64-unknown-linux-gnu"`
6366

67+
## Semantics of target with attributes
68+
69+
The shorthand form of `#[cfg(target(os = "linux))]` is expanded and entirely
70+
equivalent to `#[cfg(target_os = "linux")]` (and so on for `arch` and the other
71+
potential attributes).
72+
6473
# Drawbacks
6574
[drawbacks]: #drawbacks
6675

0 commit comments

Comments
 (0)