Internal error with rustfmt

I guess this should be reported somewhere?

I found this

Minimized example:

fn next() {
    let _ = // This comment causes rustfmt inernal error  
    {
      if true { // whitespace symbol at the end of next line is significant
      } 
    };
}
3 Likes

A playground link in that issue contains a slightly different case. Based on that case and this OP, here is another minimized example: Rust Playground

fn f() {
    let _ = // This comment causes rustfmt inernal error 
    println!(""
 
); // and there should be at least one whitespace above this line
}

error[internal]: left behind trailing whitespace
 --> /playground/src/main.rs:4:4:1
  |
4 |  
  | ^
  |
// rustfmt works
fn f() {
    let _ = // This comment won't cause rustfmt inernal error 
    println!(""

); // with no whitespace above this line
}
1 Like

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.