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
ANN: annotate wrong return type for empty functions #5552
ANN: annotate wrong return type for empty functions #5552
Conversation
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.
If we want to do this: #4833 then it would be consistent to mark the return type (although it might be missing in case of unit type, hmm).. Otherwise I'll change it to annotate the closing brace. |
This comment has been minimized.
This comment has been minimized.
@Stzx I'm sorry, I don't understand, what do you mean? |
This comment has been minimized.
This comment has been minimized.
@mchernyavsky What error type marking should be used? Only the return type, whole function, closing brace? |
I prefer the closing brace. @Undin @vlad20012 What do you think? |
This is the reason why the PR is not merged yet? Oh... |
Yup 😅 The closing brace is probably more general, since we cannot mark the return type if it's missing. Should I change it to the brace? |
Oh 😅 |
d5aaa53
to
b1282c8
Compare
I changed it to the closing brace for empty functions. The To solve #4833 with brace highlighting, it would have to only highlight the brace in the case of a trailing expr (and highlight return expressions for |
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.
bors r+
Hmm, I think I found a false-positive case: trait FooBar {}
impl FooBar for () {}
fn foobar() -> impl FooBar {
} bors r- |
Canceled. |
Oh, that's a very... interesting case :D Well, to support cases such as this one, I wonder if maybe the error annotation for empty functions should be moved into |
|
b1282c8
to
a7f3868
Compare
bors r+ |
Build succeeded: |
Fixes: #5166