mirror of
https://github.com/rust-lang/rust.git
synced 2025-10-02 10:18:25 +00:00
Fix FnOnce impl for AsyncFn/AsyncFnMut closures in new solver
This commit is contained in:
parent
ca912d794d
commit
e0f8055871
@ -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…
x
Reference in New Issue
Block a user