-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
Recover from using ;
as separator between fields
#101457
Conversation
r? @fee1-dead (rust-highfive has picked a reviewer for you, use r? to override) |
2dba6a0
to
fbf11cf
Compare
@bors r+ rollup |
…llaumeGomez Rollup of 7 pull requests Successful merges: - rust-lang#101357 (Include enum path in variant suggestion) - rust-lang#101434 (Update `SessionDiagnostic::into_diagnostic` to take `Handler` instead of `ParseSess`) - rust-lang#101445 (Suggest introducing an explicit lifetime if it does not exist) - rust-lang#101457 (Recover from using `;` as separator between fields) - rust-lang#101462 (Rustdoc-Json: Store Variant Fields as their own item.) - rust-lang#101471 (Report number of delayed bugs properly with `-Ztreat-err-as-bug`) - rust-lang#101473 (Add more size assertions for MIR types.) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
Rustc gets better and better |
",", | ||
Applicability::MachineApplicable, | ||
); | ||
return Err(err); |
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.
Ideally this would have recovered as if a ,
had been found (emitting this error instead of returning it and calling self.bump()
)...
error: unions cannot have zero fields | ||
--> $DIR/recover-field-semi.rs:6:1 | ||
| | ||
LL | / union Bar { | ||
LL | | foo: i32; | ||
LL | | | ||
LL | | } | ||
| |_^ |
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.
Which would have caused this error to not be emitted (and other uses not to complain about a missing foo
field).
Partially fixes #101440 (only for record structs).
Doing that for tuple structs is harder as their parsing passes through a bunch of helper functions. I don't know how to do that. But their error message is better anyway and suggests using a comma, even if it doesn't suggest replacing the semicolon with it.