Skip to content

Commit 22bba4c

Browse files
committed
Mention --print cfg under set configuration options
This often serves as the landing page for information about which `target_*` configuration options are available. Mention that `rustc` can print the exact options available for each target.
1 parent 9c21bee commit 22bba4c

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/conditional-compilation.md

+12
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,18 @@ configuration option from within the source code of the crate being compiled.
5858
> [!WARNING]
5959
> Arbitrarily-set configuration options can clash with compiler-set configuration options. For example, it is possible to do `rustc --cfg "unix" program.rs` while compiling to a Windows target, and have both `unix` and `windows` configuration options set at the same time. Doing this would be unwise.
6060
61+
Some default configuration values can be obtained from `rustc`:
62+
63+
```text
64+
rustc --print cfg # optionally, a --target can be specified
65+
target_abi=""
66+
target_arch="aarch64"
67+
target_endian="little"
68+
target_env=""
69+
target_family="unix"
70+
...
71+
```
72+
6173
### `target_arch`
6274

6375
Key-value option set once with the target's CPU architecture. The value is

0 commit comments

Comments
 (0)