-
-
Notifications
You must be signed in to change notification settings - Fork 14.8k
Cannot combine async fn-in-traits with AsyncFn{,Mut} closures #145127
Copy link
Copy link
Open
Labels
A-async-awaitArea: Async & AwaitArea: Async & AwaitA-async-closures`async || {}``async || {}`A-auto-traitsArea: auto traits (e.g., `auto trait Send {}`)Area: auto traits (e.g., `auto trait Send {}`)A-higher-rankedArea: Higher-ranked things (e.g., lifetimes, types, trait bounds aka HRTBs)Area: Higher-ranked things (e.g., lifetimes, types, trait bounds aka HRTBs)C-bugCategory: This is a bug.Category: This is a bug.fixed-by-higher-ranked-assumptionsFixed by `-Zhigher-ranked-assumptions`Fixed by `-Zhigher-ranked-assumptions`
Metadata
Metadata
Assignees
Labels
A-async-awaitArea: Async & AwaitArea: Async & AwaitA-async-closures`async || {}``async || {}`A-auto-traitsArea: auto traits (e.g., `auto trait Send {}`)Area: auto traits (e.g., `auto trait Send {}`)A-higher-rankedArea: Higher-ranked things (e.g., lifetimes, types, trait bounds aka HRTBs)Area: Higher-ranked things (e.g., lifetimes, types, trait bounds aka HRTBs)C-bugCategory: This is a bug.Category: This is a bug.fixed-by-higher-ranked-assumptionsFixed by `-Zhigher-ranked-assumptions`Fixed by `-Zhigher-ranked-assumptions`
Type
Fields
Give feedbackNo fields configured for issues without a type.
This program:
fails to compile with:
A similar version of this program with a
dyn-compatible trait also does not compile:and this fails with a different error:
My instinct is that both of these programs should compile. Replacing
AsyncFnMutwithAsyncFnyields similar errors, but replacing the bound withAsyncFnOncemakes these errors go away. This feels like a bug in the compiler so I wanted to be sure to document this, but if I'm also misunderstanding things it might be good to also improve the error message here as a diagnostics issue.Meta
rustc --version --verbose: