-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
cargo config get
doesn't seem to pick up RUSTFLAGS or RUSTDOCFLAGS
#12087
Comments
I would say it is kinda intentional. The Cargo configuration system only cares about environment variables starting with Try this instead:
However, we must admit that the story around rustflags management is a bit messy. Footnotes |
I see, but the docs do mention
|
The usecase here is being able to accurately predict what extra flags will be passed when invoking |
Since For now, I'll triage this issue as
A-documenting-cargo-itself
|
After going through the discussion above, a with very little knowledge of what's going on, I think you guys are talking about changing this- build.rustflags
Type: string or array of strings
Default: none
Environment: CARGO_BUILD_RUSTFLAGS or CARGO_ENCODED_RUSTFLAGS or RUSTFLAGS
Extra command-line flags to pass to rustc. The value may be an array of strings or a space-separated string. to- build.rustflags
Type: string or array of strings
Default: none
--> Environment: CARGO_BUILD_RUSTFLAGS or CARGO_ENCODED_RUSTFLAGS or RUSTFLAGS <-- N-stating this line
Extra command-line flags to pass to rustc. The value may be an array of strings or a space-separated string. But Idk what N-stating a line means, so if you could shower some more light on the issue,I would be happy to do the doc work for this issue! |
I'd like to understand this better:
Are we saying that My impression is that the latter is happening. |
By configuration I mean Cargo's configuration system specifically, which serializes equivalent |
I see what you mean, but I disagree with the premise of what the "Cargo Configuration System" is. In an "ideal" scenario, the mechanism powering I also do understand that the whole situation is fairly messy and it probably requires some design work to be sorted out, and that's OK. |
120% agree. Users don't and shouldn't care about what a cargo configuration really is. My suggestion was clarifying that RUSTFLAGS won't reflect in the system but still affect the behavior. Thinking of it a bit more, we want to answer users what and how rustc got those flags eventually. It could be lots of work to hack the config system doing so. Doc still needs some tweaks but doesn't effectively resolve this issue though. Thanks for calling out the confusion as an end user! |
I got an idea for this. Since rustflags is an important config for Cargo, we could have a separate This is not yet accepted by the Cargo team but is definitely not a bad idea to me. |
Is there any interest in this? |
Most definitely—it would be a solution here. |
To avoid any misleading, I'll relabel this issue for some solution like @rustbot label +S-needs-design -S-accepted +E-hard -E-easy |
Problem
cargo config get build.rustdocflags
andcargo config get build.rustflags
do not seem to behave as I would have expected.If the respective environment variables are set (i.e.
RUSTDOCFLAGS
andRUSTFLAGS
) but no value is set in.cargo/config.toml
, I'd expect the environment variable value to be returned.Instead, the command fails with:
Steps
and
Possible Solution(s)
No response
Notes
Is this intended behaviour?
Version
No response
The text was updated successfully, but these errors were encountered: