-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Do not complain about missing main when a block has been recovered #67413
Conversation
|
||
// Avoid complaining about main in | ||
// `src/test/ui/parser/mismatched-braces/missing-close-brace-in-trait.rs`. | ||
*self.sess.reached_eof.borrow_mut() = true; |
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.
Are you sure that we actually reach Eof
in all cases, e.g. the return
below?
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.
changed
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.
I had to change it back. Setting reached_eof
before all of the return
s in the loop
would cause the missing main
error to come up (!?).
bf807ef
to
5ba85e6
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
5ba85e6
to
e63a9fc
Compare
This comment has been minimized.
This comment has been minimized.
I don't feel entirely comfortable reviewing the correctness of this right now (in particular that we don't suddenly allow code) and I don't have much time to do an in-depth review, so I'll r? @petrochenkov for now. That said, here's a sledge-hammer suggestion which would be easy to be confident in: Record whether |
I'd rather get rid of This is such a random ad hoc bit of logic. |
The existing logic seems to set I don't want to have this debt accumulating on top of other debt, reporting a false positive "no main" error in some cases has much less importance than that. |
Follow up to https://github.com/rust-lang/rust/pull/66183/files#r346077120.
r? @Centril