Closed
Description
Given the code:
fn foo() -> u16 {
1;
}
Rustc shows the error:
error: not all control paths return a value [E0269]
However, I think this is slightly misleading. There isn't actual a control path here, just a semicolon that shouldn't be there.
I think rustc should say something like "function does not return a value" when the last expression in a function is a simple expression without any control flow.