-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Inform build scripts of rustc compiler context #9601
Changes from 17 commits
6ee606b
bdf49cb
44491ee
719eb59
8012d32
1e40745
49d33c4
055a243
715fab4
c16b9d4
fb0d41f
fa7c5b1
a01c5dd
8199f85
f927d2a
d6b4a06
d0c751b
9313266
1cbce47
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -35,11 +35,17 @@ system: | |
* `RUSTDOCFLAGS` — A space-separated list of custom flags to pass to all `rustdoc` | ||
invocations that Cargo performs. In contrast with [`cargo rustdoc`], this is | ||
useful for passing a flag to *all* `rustdoc` instances. See | ||
[`build.rustdocflags`] for some more ways to set flags. | ||
[`build.rustdocflags`] for some more ways to set flags. This string is | ||
split by whitespace; for a more robust encoding of multiple arguments, | ||
set `CARGO_ENCODED_RUSTDOCFLAGS` instead with arguments separated by | ||
`0x1f` (ASCII Unit Separator). | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe use There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do all platforms support arbitrary bytes in environment variables? Using invalid UTF-8 would also mean you'd have to consume it with There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah, I also consider the delimiter being valid UTF-8 a benefit. It's true that someone could used |
||
* `RUSTFLAGS` — A space-separated list of custom flags to pass to all compiler | ||
invocations that Cargo performs. In contrast with [`cargo rustc`], this is | ||
useful for passing a flag to *all* compiler instances. See | ||
[`build.rustflags`] for some more ways to set flags. | ||
[`build.rustflags`] for some more ways to set flags. This string is | ||
split by whitespace; for a more robust encoding of multiple arguments, | ||
set `CARGO_ENCODED_RUSTFLAGS` instead with arguments separated by | ||
`0x1f` (ASCII Unit Separator). | ||
* `CARGO_INCREMENTAL` — If this is set to 1 then Cargo will force [incremental | ||
compilation] to be enabled for the current compilation, and when set to 0 it | ||
will force disabling it. If this env var isn't present then cargo's defaults | ||
|
@@ -334,12 +340,25 @@ let out_dir = env::var("OUT_DIR").unwrap(); | |
* `RUSTC`, `RUSTDOC` — the compiler and documentation generator that Cargo has | ||
resolved to use, passed to the build script so it might | ||
use it as well. | ||
* `RUSTC_WRAPPER` — the `rustc` wrapper, if any, that Cargo is using. | ||
See [`build.rustc-wrapper`]. | ||
* `RUSTC_WORKSPACE_WRAPPER` — the `rustc` wrapper, if any, that Cargo is | ||
using for workspace members. See | ||
[`build.rustc-workspace-wrapper`]. | ||
* `RUSTC_LINKER` — The path to the linker binary that Cargo has resolved to use | ||
for the current target, if specified. The linker can be | ||
changed by editing `.cargo/config.toml`; see the documentation | ||
about [cargo configuration][cargo-config] for more | ||
information. | ||
* `CARGO_ENCODED_RUSTFLAGS` — extra flags that Cargo invokes `rustc` | ||
with, separated by a `0x1f` character | ||
(ASCII Unit Separator). See | ||
[`build.rustflags`]. | ||
* `CARGO_PKG_<var>` - The package information variables, with the same names and values as are [provided during crate building][variables set for crates]. | ||
* `RUSTC_VERSION` - The version of rustc used by the cargo that invokes | ||
the build script. Its constituent parts are also | ||
available as `CARGO_VERSION_MAJOR`, `_MINOR`, and | ||
`_PATCH`. | ||
jonhoo marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
[unix-like platforms]: ../../reference/conditional-compilation.html#unix-and-windows | ||
[windows-like platforms]: ../../reference/conditional-compilation.html#unix-and-windows | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doesn't seem necessary?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, it is, because
.split()
on an empty string returns an iterator with one item (""
), which we'd pass as an empty argument to rustc, which can make it confused. See also #9601 (comment).