forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of rust-lang#134017 - compiler-errors:call-once-deduction, r=jieyouxu Don't use `AsyncFnOnce::CallOnceFuture` bounds for signature deduction We shouldn't be using `AsyncFnOnce::CallOnceFuture` projection bounds to deduce anything about the return type of an async closure, **only** `AsyncFnOnce::Output`. This was accidental b/c all we were looking at was the def id of the trait, rather than the projection. This PR fixes that. This doesn't affect stable code, since `CallOnceFuture` bounds cannot be written on stable. Fixes rust-lang#134015
- Loading branch information
Showing
2 changed files
with
18 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
tests/ui/async-await/async-closures/call-once-deduction.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
//@ edition: 2021 | ||
//@ check-pass | ||
|
||
#![feature(async_closure, async_fn_traits, unboxed_closures)] | ||
|
||
fn bar<F, O>(_: F) | ||
where | ||
F: AsyncFnOnce<(), CallOnceFuture = O>, | ||
{ | ||
} | ||
|
||
fn main() { | ||
bar(async move || {}); | ||
} |