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

Regression in return type error quality with impl trait #50652

Open
jonathandturner opened this Issue May 11, 2018 · 2 comments

Comments

Projects
None yet
4 participants
@jonathandturner
Copy link
Contributor

jonathandturner commented May 11, 2018

In playing with impl trait this morning, I noticed that if you do the classic "oops, I left a ; after my return value" error, instead of the helpful message asking if you meant to have the semi-colon, you get this:

screen shot 2018-05-11 at 5 20 58 am

We should definitely try to cover this case too with the same improved error messages we have for other return types.

@jonathandturner

This comment has been minimized.

Copy link
Contributor Author

jonathandturner commented May 11, 2018

Test case

trait Bar {}
impl Bar for bool {}

fn baz() -> impl Bar {
    true;
}

fn main() {
    baz();
}
@larsluthman

This comment has been minimized.

Copy link

larsluthman commented May 12, 2018

The same error message appears if your function body consists of 'unimplemented!()' or 'panic!()'. In that case it should probably say something like 'Failed to infer return type' instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment