-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Cut out a bunch of Result and panictry! boilerplate from libsyntax. #30654
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
Conversation
[breaking-change] if you use any of the changed functions, you'll need to remove a try! or panictry!
(rust_highfive has picked a reviewer for you, use r? to override) |
The two test case changes look like regressions. Why are they ok? |
What's the path forward here? It looks like panictry is intended to be the way to convert the parser to not panic by ultimately converting panictry to try. |
The path forward is that the parser works like the rest of the compiler and emits errors as it goes along, if it panics it does so only at the end of parsing. We do our best to recover from errors at as low a level as possible and pass up errors only when we can't recover from them. |
@@ -14,6 +14,7 @@ | |||
|
|||
fn foo(p: proc()) { } //~ ERROR `proc` is a reserved keyword | |||
|
|||
fn bar() { proc() 1; } | |||
fn bar() { proc() 1; } //~ ERROR `proc` is a reserved keyword | |||
//~^ ERROR 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.
in this test we get a more informative error message because we are panicking a little bit later
r? @brson |
@bors r+ |
📌 Commit 9023c65 has been approved by |
The motivation (other than removing boilerplate) is that this is a baby step towards a parser with error recovery. [breaking-change] if you use any of the changed functions, you'll need to remove a try! or panictry!
The motivation (other than removing boilerplate) is that this is a baby step towards a parser with error recovery.
[breaking-change] if you use any of the changed functions, you'll need to remove a try! or panictry!