-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
inform user where to give a type annotation after a call to collect #47777
Comments
The only thing I'd add is that there are two cases, one where this error happens with a let binding, like in this case, where suggesting giving a type to the binding might be less surprising, and every other case, from having multiple collect to being a return, where the only place to add the type is in the method call itself. |
Those two cases are already handled by the code that seeks to give hints. That code lives in this unfortunately uncommented method:
I believe that the idea is that it reports an error that the type Probably all we have to do is to call this function from here: rust/src/librustc_typeck/check/mod.rs Lines 4969 to 4971 in 70f7d58
As a bonus, we can remove E0619, which would be subsumed into the existing error code. The call would look something like: self.need_type_info(Some(self.body_id), sp, ty); |
I’ll take this. |
…tebank inform user where to give a type annotation should resolve rust-lang#47777 previous pull request rust-lang#47982 was closed because of a mistaken rebase. r? @estebank
@csmoe hi! don't hesitate to ask anything related to |
…tebank inform user where to give a type annotation should resolve rust-lang#47777 previous pull request rust-lang#47982 was closed because of a mistaken rebase. r? @estebank
UPDATE: Mentoring instructions below.
We are not giving a very good error message in this example:
We say:
It'd be nice if we at least informed the user that they ought to annotate the type of
dirty_list
. (Indeed, I know we used to have a bug on this, and I thought we were doing so...?)It'd be nicer still if we recognized that there is a call to
collect
and were able to say something like "you need to specify the kind of collection".cc @estebank
The text was updated successfully, but these errors were encountered: