Unexpected interactions with async blocks, auto traits, and trait objects #67036
Labels
A-async-await
Area: Async & Await
A-diagnostics
Area: Messages for errors, warnings, and lints
A-lifetimes
Area: Lifetimes / regions
A-trait-system
Area: Trait system
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
T-lang
Relevant to the language team, which will review and decide on the PR/issue.
The source below does not compile, where the expected behavior is for it to compile as far as I can tell. Removing the
Send
bound ondrop_send
causes it to compile. Removing theasync {}.await
no-op causes it to compile. This seems likely related to #64552, with the same sort of leakage of regions that should not be user-visible occurring. However, the error message is quite opaque in this case.My presumption is therefore that the auto trait is being correctly satisfied in the generator for some lifetime, the implementation of
Bound
is implicitly constrained onSend
byObject
where the async block is required to beSend
, so #64552 is occurring in a lifetime-dependent fashion resulting in an altogether surprising error message. I'm not as familiar with borrow checker internals as I'd like so this may be barking up the wrong tree.I am, however, unclear as to why the associated type parametrization over
T::Type
as opposed to simplyT
is necessary to reproduce.Finally, here is a playground demonstrating this issue to show independence from any local state of my own system
The text was updated successfully, but these errors were encountered: