-
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
Confusing error: Immutable reference to future is not a future #87211
Comments
Agreed that these could all be clearer. Immutable references to This is a great issue for someone relatively new to the compiler to pick up. Start by finding the source of each error message, then adding custom logic to print a specialized message for this particular case. (The individual error messages could be fixed one at a time.) |
@rustbot label +AsyncAwait-Triaged +E-mentor +E-help-wanted |
@rustbot claim |
@rustbot claim (did not mean to unassign myself... sorry that I have not been quick on this issue.) |
hey @tmandry, I’ve been caught up with some life stuff and just have not had the whitespace to sit down and toy with this. Sorry for delaying this issue, but I think I’m going to unassign myself for the time being. is that okay? |
@tmandry maybe this should return to “On Deck”? |
@rustbot claim |
The solution to this seems to be filtering the
But this is not giving the expected result even though the type of
@tmandry thoughts? |
@rahul-ar That's not terribly surprising, I wouldn't expect You could find out why it's not handled (with debug logging). Or you can handle this case directly (for all We already print decent error messages for the general case (traits other than |
I am surprised. You can look at where |
Given the following code:
playground
The current output is:
Given the following code:
playground
The current output is:
Given the following code:
playground
The current output is:
In all three cases, it would be very helpful if the compiler could explicitly call out that an immutable reference to a future is not a future. I see this relatively often in the Tokio discord where people put some extra ampersands in random places and get really confused when the error says "impl future is not future". The ampersand in the error is not enough to clue them in to what the issue is. Especially for the first case.
The text was updated successfully, but these errors were encountered: