-
Notifications
You must be signed in to change notification settings - Fork 13.2k
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
Suggest as_mut to reborrow Pin when calling method #65409
Comments
Seems reasonable to me. Should we tag this A-async-await? Seems to fall under the "async foundations" purview, anyway. (Slight mismatch between those labels, I guess) |
@nikomatsakis Yes, let's. Any thoughts re. implementation? ;) |
Happy to give this one a go - the hint would certainly help me if I stumbled into this. |
Rather than being specific to Pin, can we expand the scope and add a hint to the general error message:
and if possible specialise the error message if the type supports as_ref()/as_mut()? As a user, that's the kind of error message I'd be greatful to receive - a hint as to whether the type is clonable or not and if there's a as_mut() call I could be using rather than trying to &mut it. |
For normal |
@rustbot release-assignment |
Addressed the For the general case of suggesting Edit: Figured out a hack to suggest clone. That PR will close this ticket. |
…r-errors Suggest `Pin::as_mut` when encountering borrow error Fix rust-lang#65409 for `Pin<&mut T>`.
I have seen a lot of newcomers to futures stumble with
Pin<&mut Self>
methods consuming the pin, if possible this seems like a good candidate for a custom diagnostic.As a self-contained example (playground):
currently errors with
it would be useful if this error included something like
The text was updated successfully, but these errors were encountered: