-
Notifications
You must be signed in to change notification settings - Fork 13.2k
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 long error explanation for E0573 #65234
Add long error explanation for E0573 #65234
Conversation
Some changes occurred in diagnostic error codes |
r? @estebank (rust_highfive has picked a reviewer for you, use r? to override) |
The job Click to expand the log.
I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact |
9c59e3a
to
f2255b4
Compare
☔ The latest upstream changes (presumably #65454) made this pull request unmergeable. Please resolve the merge conflicts. |
f2255b4
to
33779fb
Compare
r? @kinnison |
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.
Mostly good, just a couple of language tweaks I think might be worth it.
src/librustc_resolve/error_codes.rs
Outdated
@@ -1611,6 +1611,80 @@ fn print_on_failure(state: &State) { | |||
``` | |||
"##, | |||
|
|||
E0573: r##" | |||
Something else than a type has been used when one was expected. |
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.
I'd suggest 'other' rather than 'else' here.
Something other than a type has been used when one was expected.
src/librustc_resolve/error_codes.rs
Outdated
``` | ||
|
||
In all these errors, a type was expected. For example, in the first error, | ||
if we want to return `Born` variant from the `Dragon` enum, we have set the |
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.
I'd suggest:
if we want to return the
Born
variant from theDragon
enum, we must make the
function return theDragon
enum and not its variant:
33779fb
to
ae4bbbb
Compare
Updated! |
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.
One more tweak
src/librustc_resolve/error_codes.rs
Outdated
In all these errors, a type was expected. For example, in the first error, if | ||
we want to return the `Born` variant from the `Dragon` enum, we have set the | ||
function returning the enum and not its variant: |
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 still doesn't quite read nicely.
If you replace 'we have set the function returning' with 'we must set the function to return' then it would read better.
ae4bbbb
to
7d357fb
Compare
Updated. |
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.
👍
@bors: r=kinnison |
📌 Commit 7d357fb has been approved by |
…innison Add long error explanation for E0573 Part of #61137.
☀️ Test successful - checks-azure |
Tested on commit rust-lang/rust@7e49800. Direct link to PR: <rust-lang/rust#65234> 💔 rls on linux: test-pass → test-fail (cc @Xanewok, @rust-lang/infra).
} | ||
|
||
trait Isengard { | ||
fn wizard(w: Wizard) { // error! |
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.
Hi, just a random late comment from an outsider... Should the // error!
commet be removed because this is a corrected example, shouldn't it?
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.
Excellent point! We completely missed it... Do you want to send a PR to fix it?
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.
@GuillaumeGomez Hi, I just created one! #65620
…arkor Correctly note code as Ok not error for E0573 Hi, this is my first pull request to the Rust project. The fix is very small one just to fix an oversight in a comment. Namely, [this documentation PR](rust-lang#65234) added a longer explanation for E0573. It illustrated the error using erroneous/corrected contrasting examples. But it accidentally forgot to remove `// error` from the corrected example. Sadly, I found the error after the PR got merged. [As suggested by the original author](https://github.com/rust-lang/rust/pull/65234/files#r336518549) of the PR, I created an PR to fix this. Part of rust-lang#61137.
Part of #61137.