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

Recover from using ; as separator between fields #101457

Merged
merged 1 commit into from
Sep 6, 2022

Conversation

ChayimFriedman2
Copy link
Contributor

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.

@rustbot rustbot added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label Sep 5, 2022
@rust-highfive
Copy link
Collaborator

r? @fee1-dead

(rust-highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Sep 5, 2022
@fee1-dead
Copy link
Member

@bors r+ rollup

@bors
Copy link
Contributor

bors commented Sep 6, 2022

📌 Commit fbf11cf has been approved by fee1-dead

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Sep 6, 2022
bors added a commit to rust-lang-ci/rust that referenced this pull request Sep 6, 2022
…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
@bors bors merged commit 78968e5 into rust-lang:master Sep 6, 2022
@rustbot rustbot added this to the 1.65.0 milestone Sep 6, 2022
@ChayimFriedman2 ChayimFriedman2 deleted the struct-field-semi branch September 6, 2022 21:18
@leonardo-m
Copy link

Rustc gets better and better

",",
Applicability::MachineApplicable,
);
return Err(err);
Copy link
Contributor

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())...

Comment on lines +19 to +26
error: unions cannot have zero fields
--> $DIR/recover-field-semi.rs:6:1
|
LL | / union Bar {
LL | | foo: i32;
LL | |
LL | | }
| |_^
Copy link
Contributor

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).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add help suggestion for semicolon used inside struct declaration
8 participants