-
-
Notifications
You must be signed in to change notification settings - Fork 14.4k
Try to recover from over-parsing in const item with missing semicolon #151247
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
base: main
Are you sure you want to change the base?
Try to recover from over-parsing in const item with missing semicolon #151247
Conversation
0851ad6 to
b1dcdd1
Compare
| error[E0308]: mismatched types | ||
| --> $DIR/const-recover-semi-issue-151149.rs:15:19 | ||
| | | ||
| LL | const fn foo() -> &'static u8 { | ||
| | --- ^^^^^^^^^^^ expected `&u8`, found `()` | ||
| | | | ||
| | implicitly returns `()` as its body has no tail or `return` expression |
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.
It'd be lovely if we could mark the function's tail expr as TyKind::Err so that we didn't emit a second error...
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.
is there any flag from parser we can set it directly?
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.
commit 471b929 will remove the later mismatched error, not sure there is any simpler solution, seems a little over engineering for a corner case.
ca9fa0b to
acb4b6a
Compare
acb4b6a to
68d28b5
Compare
Fixes #151149
r? @estebank