Skip to content

Commit

Permalink
Merge --print cfg with existing note block
Browse files Browse the repository at this point in the history
  • Loading branch information
ehuss authored Oct 22, 2024
1 parent 22bba4c commit e7f58b4
Showing 1 changed file with 1 addition and 13 deletions.
14 changes: 1 addition & 13 deletions src/conditional-compilation.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ passed to the compiler outside of the code. It is not possible to set a
configuration option from within the source code of the crate being compiled.

> **Note**: For `rustc`, arbitrary-set configuration options are set using the
> [`--cfg`] flag.
> [`--cfg`] flag. Configuration values for a specified target can be displayed with `rustc --print cfg --target $TARGET`.
> **Note**: Configuration options with the key `feature` are a convention used
> by [Cargo][cargo-feature] for specifying compile-time options and optional
Expand All @@ -58,18 +58,6 @@ configuration option from within the source code of the crate being compiled.
> [!WARNING]
> 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.
Some default configuration values can be obtained from `rustc`:

```text
rustc --print cfg # optionally, a --target can be specified
target_abi=""
target_arch="aarch64"
target_endian="little"
target_env=""
target_family="unix"
...
```

### `target_arch`

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

0 comments on commit e7f58b4

Please sign in to comment.