Skip to content
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

mention RUSTFLAGS in -Z unknown error #9318

Conversation

boringcactus
Copy link

#5546 suggests only doing this if the provided flag is a valid -Z arg for rustc, which would be better but also more complex to determine. this should be good enough as is, IMO.

@rust-highfive
Copy link

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @alexcrichton (or someone else) soon.

If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes.

Please see the contribution instructions for more information.

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Apr 1, 2021
@alexcrichton
Copy link
Member

Thanks for the PR, but I'm personally wary of suggestions like this. This error message mostly presumes that all unknown -Z flags were probably meant for rustc and that RUSTFLAGS would work for passing it, but neither of those are necessarily correct. I'm not really sure what to do though about improving the error message here

@boringcactus
Copy link
Author

well, one option would be to only do that for -Z flags that rustc will actually accept, but that would either require shelling out to rustc -Z help and parsing the output (bad) or hardcoding the list (worse).

i guess a different approach would be to mention RUSTFLAGS or some other way of passing -Z flags to rustc in https://github.com/rust-lang/rust/blob/master/compiler/rustc_errors/src/emitter.rs#L326, but i'm not sure that's better.

the ugliest imaginable hack would be to only mention RUSTFLAGS-or-whatever if the unknown -Z flag is macro-backtrace. it's bad, but it solves the immediate problem of "rustc says to use -Z macro-backtrace but then if you try cargo build -Z macro-backtrace you get an unhelpful error message".

@alexcrichton
Copy link
Member

Perhaps rustc could detect it's invoked by cargo and change its error message then? I think the CARGO env var will be set in that case

@bors
Copy link
Collaborator

bors commented Apr 20, 2021

☔ The latest upstream changes (presumably #9369) made this pull request unmergeable. Please resolve the merge conflicts.

@ehuss
Copy link
Contributor

ehuss commented Aug 6, 2021

I'm gonna close this due to inactivity. I understand it can be confusing trying to figure out which flags should go to cargo and which to rustc. However, it isn't entirely clear if this is the right approach. Thanks!

@ehuss ehuss closed this Aug 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-review Status: Awaiting review from the assignee but also interested parties.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants