-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Misleading note for accessing closures within structs. #32128
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
Comments
If I'm right, we should be able to check to see if the field implements one of the |
The check already exists, but it only checks for |
@durka as far as I know anything that implements any of the |
@Aatch is it feasible to start up the deref machinery just for a note in an error message? I don't really know how that stuff works. |
@durka it's a single call, search for |
…r-fn-ty, r=nagisa Autoderef when suggesting to call `(self.field)` Fixes rust-lang#32128
Hi, I encountered an issue the other day wherein I was attempting to call a closure stored within a struct.
The compiler gives a misleading error which doesn't give the user an idea on how to fix the problem.
I've prepared an example which reproduces the misleading text:
The error this yields from the compiler is as follows:
Note that in the source code I've provided, underneath the line which yields this error, I have provided a comment demonstrating the correct way to access and call the example member of the structure, however the compiler's example is identical to the erroneous code and thus doesn't help the user in working out how to properly call the member.
Would it be at all possible to improve this error message?
I've confirmed this is reproducible on
rustc 1.7.0 (a5d1e7a59 2016-02-29)
.The text was updated successfully, but these errors were encountered: