Unclear diagnostics for async callback that takes a reference #76609
Labels
A-async-await
Area: Async & Await
A-diagnostics
Area: Messages for errors, warnings, and lints
A-lifetimes
Area: Lifetimes / regions
AsyncAwait-Triaged
Async-await issues that have been triaged during a working group meeting.
D-confusing
Diagnostics: Confusing error or lint that should be reworked.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
This code..
...triggers this diagnostic:
and it's completely unclear to me how to fix it. Well, obviously the problem is that the callback takes a reference, but even that took me some time to realize (longer than I'd like to admit). In the end I just removed it and did it differently.
This code came from refactoring of some non-async code, so I for some time I didn't realize that I was doing something fishy. I don't have much experience with async rust, so I don't know if this is even possible to fix while still keeping the reference there (maybe with some clever bounds?). If not, it should probably suggest you to rewrite it to not use that reference.
The text was updated successfully, but these errors were encountered: