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

Add an easier way of running rustc --explain #13888

Closed
dev-ardi opened this issue May 8, 2024 · 7 comments
Closed

Add an easier way of running rustc --explain #13888

dev-ardi opened this issue May 8, 2024 · 7 comments
Labels
C-feature-request Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted` S-needs-info Status: Needs more info, such as a reproduction or more background for a feature request.

Comments

@dev-ardi
Copy link

dev-ardi commented May 8, 2024

Problem

fn main() {
    hello
}

This errors with E0425. It would be nice if cargo offered a way to explain the error in depth!

error[E0425]: cannot find value `hello` in this scope
 --> src/main.rs:2:5
  |
2 |     hello
  |     ^^^^^ not found in this scope

For more information about this error, try `rustc --explain E0425`.
error: could not compile `tests` (bin "tests") due to 1 previous error

You can of course copy and paste the command but it would be nicer to not have to.

Proposed Solution

You could run cargo check --explain that opens up the help page for the given error.

Notes

No response

@dev-ardi dev-ardi added C-feature-request Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted` S-triage Status: This issue is waiting on initial triage. labels May 8, 2024
@weihanglo
Copy link
Member

Are you proposing cargo --explain without a given error code should just check the latest error we've got?

@weihanglo weihanglo added S-needs-info Status: Needs more info, such as a reproduction or more background for a feature request. and removed S-triage Status: This issue is waiting on initial triage. labels May 8, 2024
@dev-ardi
Copy link
Author

dev-ardi commented May 8, 2024

More specifically, adding it to check, build, etc should do that if it encounters any explainable error.

Not sure what should happen for several errors.

@epage
Copy link
Contributor

epage commented May 8, 2024

rustc has been exploring hyperlink support and having the error codes be a link to the relevant page seems the most useful. You could immediately click the link without having to go back in your history to re-run the command and then avoid that entry in your history when you want to run without it.

@dev-ardi
Copy link
Author

dev-ardi commented May 9, 2024

That would be even better indeed

@weihanglo
Copy link
Member

@epage do you have any discussion we can link to? I think we can close this in favor of that then.

@epage
Copy link
Contributor

epage commented May 9, 2024

@weihanglo
Copy link
Member

Sounds good. Thanks and close in favor of those.

@dev-ardi feel free to join and discuss on Zulip :)

@weihanglo weihanglo closed this as not planned Won't fix, can't repro, duplicate, stale May 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-feature-request Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted` S-needs-info Status: Needs more info, such as a reproduction or more background for a feature request.
Projects
None yet
Development

No branches or pull requests

3 participants