Skip to content

rustfmt reorders for and async in impl for<'chk> async Fn #131649

Closed

Description

@nikomatsakis

I tried formatting this code:

#![feature(async_closure)]

async fn my_func(op: impl for<'x> async Fn(&'x String)) {
    let s = String::new();
    op(&s).await
}

fn main() { }

I expected to see this happen: nothing

Instead, this happened: rustfmt reorders for and async incorrectly...

#![feature(async_closure)]

async fn my_func(op: impl async for<'x> Fn(&'x String)) {
    let s = String::new();
    op(&s).await
}

fn main() {}

This formatted code does not compile.

Activity

  1. added
    needs-triageThis issue may need triage. Remove when done. See docs forge.rust-lang.org/release/issue-triaging
    on Oct 13, 2024
  2. nikomatsakis commented on Oct 13, 2024

    @nikomatsakis
    ContributorAuthor

    cc @compiler-errors I imagine this blocks stabilization.

  3. compiler-errors commented on Oct 13, 2024

    @compiler-errors
    Contributor

    Ah, I definitely forgot to reorder these bounds after we settled the ordering.

  4. removed
    needs-triageThis issue may need triage. Remove when done. See docs forge.rust-lang.org/release/issue-triaging
    on Oct 13, 2024
  5. added a commit that references this issue on Oct 16, 2024
    7ca54f6
  6. added a commit that references this issue on Oct 16, 2024
    950fb62
  7. added a commit that references this issue on Oct 16, 2024
    2d85fe3
  8. added
    T-rustfmtRelevant to the rustfmt team, which will review and decide on the PR/issue.
    and removed on Oct 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

A-async-closures`async || {}`C-bugCategory: This is a bug.T-rustfmtRelevant to the rustfmt team, which will review and decide on the PR/issue.

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions