You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The text was updated successfully, but these errors were encountered:
EDIT: it does not print semicolon suggestion in this exact case because the integer is infered to u32, while return value is u16. The hint code could be improved in presence of integers.
EDIT 2: this function does have a control path, albeit only a single one.
This is caused because liveliness analysis will only print the missing semicolon warning if the types of the last statement and the return value of the function are equivalent.
Given the code:
Rustc shows the error:
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.
The text was updated successfully, but these errors were encountered: