Closed
Description
The code that truncates long lines doesn't take (hard) tabs into account, so the lines printed are off.
Example code:
fn main() {
let money = 42i32;
match money {
v @ 1 | 2 | 3 => panic!("You gave me too little money {}", v), // Long text here: TTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTT
v => println!("Enough money {}", v),
}
}
Gives the following error:
error[E0408]: variable `v` is not bound in all patterns
--> src/main.rs:4:19
|
4 | ... v @ 1 | 2 | 3 => panic!("You gave me too little money {}", v), // Long text here: TTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTT...
| - ^ ^ pattern doesn't bind `v`
| | |
| | pattern doesn't bind `v`
| variable not in all patterns
error: aborting due to previous error
If you use four spaces instead of each tab
fn main() {
let money = 42i32;
match money {
v @ 1 | 2 | 3 => panic!("You gave me too little money {}", v), // Long text here: TTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTT
v => println!("Enough money {}", v),
}
}
it works as expected:
error[E0408]: variable `v` is not bound in all patterns
--> src/main.rs:4:49
|
4 | ... v @ 1 | 2 | 3 => panic!("You gave me too little money {}", v), // Long text here: TTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTT...
| - ^ ^ pattern doesn't bind `v`
| | |
| | pattern doesn't bind `v`
| variable not in all patterns
cc @estebank