rustfmt icon indicating copy to clipboard operation
rustfmt copied to clipboard

Rustfmt duplicate associated type bound in the presence of comment

Open sgdxbc opened this issue 1 year ago • 3 comments

I tried this code:

trait Foo {
    type Bar<'a>: Baz1 // 
     where Self: 'a;
}

Run rustfmt

trait Foo {
    type Bar<'a>: Baz1
    : Baz1 //
    where
        Self: 'a;
}

Can reproduce without <'a>, but the code would be pointless in that case.

Somewhat related: comment is discarded

trait Foo {
    type Bar: Baz1 // what
    ;
}

Run rustfmt

trait Foo {
    type Bar: Baz1;
}

Meta

rustfmt 1.7.1-nightly (35b658f 2024-07-08)
Backtrace

<backtrace>

sgdxbc avatar Jul 09 '24 11:07 sgdxbc

This is a rustfmt bug, so it should be opened against the rustfmt repo

compiler-errors avatar Jul 09 '24 13:07 compiler-errors

@rustbot transfer rustfmt

fmease avatar Jul 09 '24 17:07 fmease

Ah did not realize there's a dedicated repo for rustfmt, sorry for that> <

sgdxbc avatar Jul 10 '24 01:07 sgdxbc