Fix FnOnce impl for AsyncFn/AsyncFnMut closures in new solver
This commit is contained in:
parent
ca912d794d
commit
e0f8055871
2 changed files with 16 additions and 1 deletions
|
|
@ -327,7 +327,7 @@ pub(in crate::solve) fn extract_tupled_inputs_and_output_from_callable<I: Intern
|
|||
// always be called once. It additionally implements `Fn`/`FnMut`
|
||||
// only if it has no upvars referencing the closure-env lifetime,
|
||||
// and if the closure kind permits it.
|
||||
if closure_kind != ty::ClosureKind::FnOnce && args.has_self_borrows() {
|
||||
if goal_kind != ty::ClosureKind::FnOnce && args.has_self_borrows() {
|
||||
return Err(NoSolution);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,15 @@
|
|||
//@ edition:2021
|
||||
//@ check-pass
|
||||
//@ revisions: current next
|
||||
//@ ignore-compare-mode-next-solver (explicit revisions)
|
||||
//@[next] compile-flags: -Znext-solver
|
||||
|
||||
fn call_once<F>(_: impl FnOnce() -> F) {}
|
||||
|
||||
fn main() {
|
||||
let mut i = 0;
|
||||
let c = async || {
|
||||
i += 1;
|
||||
};
|
||||
call_once(c);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue