-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsC-bugCategory: This is a bug.Category: This is a bug.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
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
Metadata
Metadata
Assignees
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsC-bugCategory: This is a bug.Category: This is a bug.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.