Skip to content

Commit

Permalink
Rollup merge of rust-lang#33437 - brson:trips, r=Manishearth
Browse files Browse the repository at this point in the history
doc: Update reference with better description of target_env

The definition of this value recently changed slightly. It no
longer corresponds directly to the target triple.

Also shuffled things around to make the order of cfg descriptions more
logical and added text related them to the target triple.

cc rust-lang#33403
  • Loading branch information
steveklabnik committed May 7, 2016
2 parents f569b59 + 2912bfb commit 1ce9405
Showing 1 changed file with 26 additions and 18 deletions.
44 changes: 26 additions & 18 deletions src/doc/reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -2063,33 +2063,41 @@ arbitrarily complex configurations through nesting.

The following configurations must be defined by the implementation:

* `debug_assertions` - Enabled by default when compiling without optimizations.
This can be used to enable extra debugging code in development but not in
production. For example, it controls the behavior of the standard library's
`debug_assert!` macro.
* `target_arch = "..."` - Target CPU architecture, such as `"x86"`, `"x86_64"`
`"mips"`, `"powerpc"`, `"powerpc64"`, `"arm"`, or `"aarch64"`.
* `target_endian = "..."` - Endianness of the target CPU, either `"little"` or
`"big"`.
* `target_env = ".."` - An option provided by the compiler by default
describing the runtime environment of the target platform. Some examples of
this are `musl` for builds targeting the MUSL libc implementation, `msvc` for
Windows builds targeting MSVC, and `gnu` frequently the rest of the time. This
option may also be blank on some platforms.
* `target_arch = "..."` - Target CPU architecture, such as `"x86"`,
`"x86_64"` `"mips"`, `"powerpc"`, `"powerpc64"`, `"arm"`, or
`"aarch64"`. This value is closely related to the first element of
the platform target triple, though it is not identical.
* `target_os = "..."` - Operating system of the target, examples
include `"windows"`, `"macos"`, `"ios"`, `"linux"`, `"android"`,
`"freebsd"`, `"dragonfly"`, `"bitrig"` , `"openbsd"` or
`"netbsd"`. This value is closely related to the second and third
element of the platform target triple, though it is not identical.
* `target_family = "..."` - Operating system family of the target, e. g.
`"unix"` or `"windows"`. The value of this configuration option is defined
as a configuration itself, like `unix` or `windows`.
* `target_os = "..."` - Operating system of the target, examples include
`"windows"`, `"macos"`, `"ios"`, `"linux"`, `"android"`, `"freebsd"`, `"dragonfly"`,
`"bitrig"` , `"openbsd"` or `"netbsd"`.
* `unix` - See `target_family`.
* `windows` - See `target_family`.
* `target_env = ".."` - Further disambiguates the target platform with
information about the ABI/libc. Presently this value is either
`"gnu"`, `"msvc"`, `"musl"`, or the empty string. For historical
reasons this value has only been defined as non-empty when needed
for disambiguation. Thus on many GNU platforms this value will be
empty. This value is closely related to the fourth element of the
platform target triple, though it is not identical. For example,
embedded ABIs such as `gnueabihf` will simply define `target_env` as
`"gnu"`.
* `target_endian = "..."` - Endianness of the target CPU, either `"little"` or
`"big"`.
* `target_pointer_width = "..."` - Target pointer width in bits. This is set
to `"32"` for targets with 32-bit pointers, and likewise set to `"64"` for
64-bit pointers.
* `target_vendor = "..."` - Vendor of the target, for example `apple`, `pc`, or
simply `"unknown"`.
* `test` - Enabled when compiling the test harness (using the `--test` flag).
* `unix` - See `target_family`.
* `windows` - See `target_family`.
* `debug_assertions` - Enabled by default when compiling without optimizations.
This can be used to enable extra debugging code in development but not in
production. For example, it controls the behavior of the standard library's
`debug_assert!` macro.

You can also set another attribute based on a `cfg` variable with `cfg_attr`:

Expand Down

0 comments on commit 1ce9405

Please sign in to comment.