Skip to content

Suggest use of --print target-list when target is not found. #35129

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

Merged
merged 1 commit into from Jul 31, 2016
Merged

Suggest use of --print target-list when target is not found. #35129

merged 1 commit into from Jul 31, 2016

Conversation

ghost
Copy link

@ghost ghost commented Jul 30, 2016

If given target could not be found suggest using --print target-list.
Previously, error has been reported as:

$ rustc --target 86-unknown-linux-gnu
error: Error loading target specification: Could not find specification for target "86-unknown-linux-gnu"

After changes it looks as follows:

$ rustc --target 86-unknown-linux-gnu
error: Error loading target specification: Could not find specification for target "x86-unknown-linux-gnu". Use --print target-list for a list of supported targets

@rust-highfive
Copy link
Contributor

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @arielb1 (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.

@nagisa
Copy link
Member

nagisa commented Jul 30, 2016

This needs a more careful wording. --print target-list does not print all targets that would be accepted in any given environment. There’s custom json targets, RUST_TARGET_PATH and similar stuff, all of which are not covered by --print target-list.

What this should be saying instead is:

error: Error loading target specification: Could not find specification for target "x86-unknown-linux-gnu". Use `--print target-list` for a list of built-in targets.

Better off you could make the note/help an actual note:

error: Error loading target specification: Could not find specification for target "x86-unknown-linux-gnu". 
help: Use `--print target-list` for a list of built-in targets.

For that you’ll need to convert this code to use the DiagnosticBuilder. Namely the code would end up looking something like

panic!(sp.struct_fatal("Error loading…").help("Use `--print target-list`…").emit());

If given target could not be found suggest using `--print target-list`.
Previously, error has been reported as:

$ rustc --target x86-unknown-linux-gnu
error: Error loading target specification: Could not find specification for target "x86-unknown-linux-gnu"

After changes it looks as follows:

rustc --target x86-unknown-linux-gnu
error: Error loading target specification: Could not find specification for target "x86-unknown-linux-gnu"
help: Use `--print target-list` for a list of built-in targets
@ghost
Copy link
Author

ghost commented Jul 31, 2016

Thanks @nagisa. I updated the message and moved it to help sub-section. Though, I had to manually panic with errors::FatalError, otherwise main driver does not understand that panic is not unexpected (this happens because emit() doesn't return anything).

@nagisa
Copy link
Member

nagisa commented Jul 31, 2016

r=me

@eddyb
Copy link
Member

eddyb commented Jul 31, 2016

@bors r=nagisa

@bors
Copy link
Collaborator

bors commented Jul 31, 2016

📌 Commit 443f1ca has been approved by nagisa

@bors
Copy link
Collaborator

bors commented Jul 31, 2016

⌛ Testing commit 443f1ca with merge 5556554...

bors added a commit that referenced this pull request Jul 31, 2016
Suggest use of `--print target-list` when target is not found.

If given target could not be found suggest using `--print target-list`.
Previously, error has been reported as:

$ rustc --target 86-unknown-linux-gnu
error: Error loading target specification: Could not find specification for target "86-unknown-linux-gnu"

After changes it looks as follows:

$ rustc --target 86-unknown-linux-gnu
error: Error loading target specification: Could not find specification for target "x86-unknown-linux-gnu". Use `--print target-list` for a list of supported targets
@bors bors merged commit 443f1ca into rust-lang:master Jul 31, 2016
@ghost ghost deleted the suggest-print-target-list branch September 26, 2016 19:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants