libsyntax/parse: fix missing kind error reporting#41282
libsyntax/parse: fix missing kind error reporting#41282bors merged 1 commit intorust-lang:masterfrom
Conversation
|
(rust_highfive has picked a reviewer for you, use r? to override) |
|
r? @petrochenkov - how do I add error recovery? |
src/libsyntax/parse/parser.rs
Outdated
There was a problem hiding this comment.
I'd also add path.segments.len() == 1 to the condition for mistyped impl item declaration.
As for recovery, if the current token is ( then err can be emitted immediately as non-fatal (err.emit()) and we can parse remaining tokens as a method.
If the current token is : then remaining tokens can be parsed as an associated type (statistically more likely), but there's a chance for confusing error if it's actually an associated const, and this probably doesn't matter as much as methods.
There was a problem hiding this comment.
What to do if path.segments.len() != 1?
There was a problem hiding this comment.
What to do if
path.segments.len() != 1?
Report missing ! and continue parsing as a macro, most likely.
There was a problem hiding this comment.
This file shouldn't be in the PR.
ddcadbe to
d648c10
Compare
|
Now with error recovery. |
|
@bors r+ |
|
📌 Commit d648c10 has been approved by |
|
☀️ Test successful - status-appveyor, status-travis |
Fixes #41161.
Fixes #41239.