Skip to content

Conversation

@chenyukang
Copy link
Member

@chenyukang chenyukang commented Jan 17, 2026

Fixes #151149

r? @estebank

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Jan 17, 2026
@chenyukang chenyukang force-pushed the yukang-fix-const-recover-151149 branch from 0851ad6 to b1dcdd1 Compare January 17, 2026 16:52
Comment on lines 26 to 32
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
Copy link
Contributor

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...

Copy link
Member Author

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?

Copy link
Member Author

@chenyukang chenyukang Jan 19, 2026

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.

@chenyukang chenyukang force-pushed the yukang-fix-const-recover-151149 branch from ca9fa0b to acb4b6a Compare January 19, 2026 07:22
@chenyukang chenyukang force-pushed the yukang-fix-const-recover-151149 branch from acb4b6a to 68d28b5 Compare January 19, 2026 07:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Multiple errors on binding missing ; followed by implicitly returning a borrow of that binding

3 participants