-
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
libsyntax: stop early enough if keyword is found instead of ident #28444
Conversation
fixes rust-lang#28439 The signature of public `check_strict_keywords` is changed.
(rust_highfive has picked a reviewer for you, use r? to override) |
Some tests now stop early, and produce only one error message
Looks like this has some regressions in the compile-fail tests which will need to be addressed. I also think that the current behavior is fine, it's targeted at cases like: enum Foo {
Self(i32),
// ...
} In this case you'll get an error message about |
Same for me. Cons:
Pros:
I have no strong opinion about what is best, but I am slightly in favor of change. |
@alexcrichton so should I repair the test (and move it to parse-fail category), or this is a won't fix? |
In terms of recovering from parser errors, I think it makes the most sense to try to recover from errors that are likely to arise. For example it's expected that A lot of the parse-fail tests are either super old syntax or are just kinda semi-random syntax, which is bound to always give obscure parse errors. I suppose what I'm getting at is that I'm ok with obscure code giving obscure errors, it makes more sense to try to give high quality errors (and as many of them as possible) for almost-reasonable code as it's the most likely kind to be written by accident. I also wouldn't worry too much about public interfaces here, everything is unstable so we're free to change at will. |
So let's close the PR and the issue. |
Ok, thanks regardless for the PR @matklad! |
fixes #28439
The signature of public function
check_strict_keywords
is changed. This function is used only once in rustc inparse_ident
.This breaks 9 tests in
parse-fail
category, because they expect two messages instead of one. I think it's safe just to fix the tests expectations.