Skip to content

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

Closed
@nikomatsakis

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.

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions