-
-
Notifications
You must be signed in to change notification settings - Fork 14.8k
Unexpected interactions with async blocks, auto traits, and trait objects #67036
Copy link
Copy link
Closed
Labels
A-async-awaitArea: Async & AwaitArea: Async & AwaitA-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsA-lifetimesArea: Lifetimes / regionsArea: Lifetimes / regionsA-trait-systemArea: Trait systemArea: Trait systemT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.T-langRelevant to the language teamRelevant to the language team
Metadata
Metadata
Assignees
Labels
A-async-awaitArea: Async & AwaitArea: Async & AwaitA-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsA-lifetimesArea: Lifetimes / regionsArea: Lifetimes / regionsA-trait-systemArea: Trait systemArea: Trait systemT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.T-langRelevant to the language teamRelevant to the language team
Type
Fields
Give feedbackNo fields configured for issues without a type.
The source below does not compile, where the expected behavior is for it to compile as far as I can tell. Removing the
Sendbound ondrop_sendcauses it to compile. Removing theasync {}.awaitno-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
Boundis implicitly constrained onSendbyObjectwhere 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::Typeas opposed to simplyTis necessary to reproduce.Finally, here is a playground demonstrating this issue to show independence from any local state of my own system