-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
Reduce amount of errors given unclosed delimiter #65838
Conversation
r? @eddyb (rust_highfive has picked a reviewer for you, use r? to override) |
src/test/ui/parser/mismatched-braces/missing-close-brace-in-trait.stderr
Outdated
Show resolved
Hide resolved
src/libsyntax/parse/parser/item.rs
Outdated
@@ -1520,14 +1522,15 @@ impl<'a> Parser<'a> { | |||
if self.eat(&token::OpenDelim(token::Brace)) { | |||
while self.token != token::CloseDelim(token::Brace) { | |||
let field = self.parse_struct_decl_field().map_err(|e| { | |||
self.recover_stmt(); | |||
self.consume_block(token::Brace, false); |
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.
Btw... this function and friends are a mess; I tried to convert this to use the list parsing utilities before but the success was not complete; I'll probably give it a go some time in the future.
src/test/ui/parser/mismatched-braces/missing-close-brace-in-impl-trait.stderr
Show resolved
Hide resolved
cc @matklad |
This comment has been minimized.
This comment has been minimized.
177db47
to
482e245
Compare
bd19be1
to
ba25cfe
Compare
This comment has been minimized.
This comment has been minimized.
ba25cfe
to
d6a0b3c
Compare
Thanks; this looks good. r=me with commits reasonably squashed in some manner (into one or as you see fit). |
When in a file with a non-terminated item, catch the error and consume the block instead of trying to recover it more granularly in order to reduce the amount of unrelated errors that would be fixed after adding the missing closing brace. Also point out the possible location of the missing closing brace.
d6a0b3c
to
454e2aa
Compare
@bors r=Centril |
📌 Commit 454e2aa has been approved by |
Reduce amount of errors given unclosed delimiter When in a file with a non-terminated item, catch the error and consume the block instead of trying to recover it on a more granular way in order to reduce the amount of unrelated errors that would be fixed after adding the missing closing brace. Also point out the possible location of the missing closing brace. Fix rust-lang#63690.
Reduce amount of errors given unclosed delimiter When in a file with a non-terminated item, catch the error and consume the block instead of trying to recover it on a more granular way in order to reduce the amount of unrelated errors that would be fixed after adding the missing closing brace. Also point out the possible location of the missing closing brace. Fix rust-lang#63690.
Reduce amount of errors given unclosed delimiter When in a file with a non-terminated item, catch the error and consume the block instead of trying to recover it on a more granular way in order to reduce the amount of unrelated errors that would be fixed after adding the missing closing brace. Also point out the possible location of the missing closing brace. Fix #63690.
☀️ Test successful - checks-azure |
When in a file with a non-terminated item, catch the error and consume
the block instead of trying to recover it on a more granular way in order to
reduce the amount of unrelated errors that would be fixed after adding
the missing closing brace. Also point out the possible location of the
missing closing brace.
Fix #63690.