Skip to content

self-borrowing AsyncFnMut closures do not implement FnOnce #217

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
lcnr opened this issue May 22, 2025 · 0 comments · Fixed by rust-lang/rust#141359
Closed

self-borrowing AsyncFnMut closures do not implement FnOnce #217

lcnr opened this issue May 22, 2025 · 0 comments · Fixed by rust-lang/rust#141359
Assignees
Labels
from-crater A regression found via a crater run, not part of our test suite

Comments

@lcnr
Copy link
Contributor

lcnr commented May 22, 2025

fn call_once<F>(_: impl FnOnce() -> F) {}

fn main() {
    let mut i = 0;
    let c = async || {
        i += 1;
    };
    call_once(c);
}
@lcnr lcnr self-assigned this May 22, 2025
@lcnr lcnr added the from-crater A regression found via a crater run, not part of our test suite label May 22, 2025
@lcnr lcnr assigned compiler-errors and unassigned lcnr May 22, 2025
@lcnr lcnr moved this from unknown to in progress in -Znext-solver=globally May 22, 2025
rust-timer added a commit to rust-lang-ci/rust that referenced this issue May 22, 2025
Rollup merge of rust-lang#141359 - compiler-errors:async-fn-once, r=lcnr

Fix `FnOnce` impl for `AsyncFn`/`AsyncFnMut` self-borrowing closures in new solver

This only affects closures that are "`AsyncFn`/`AsyncFnMut`" in their calling capability that are being called with the `FnOnce` trait.

fixes rust-lang/trait-system-refactor-initiative#217

r? lcnr
@lcnr lcnr moved this from in progress to done in -Znext-solver=globally May 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
from-crater A regression found via a crater run, not part of our test suite
Projects
Development

Successfully merging a pull request may close this issue.

2 participants