Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix panic in annotated_snippet dependency (#4968).
* Internally, rustfmt preserves tabs and counts them as multiple characters (based on configuration). * The annotated_snippet dependency always counts tabs as 1 character. * If rustfmt tries to display an error on a line containing tabs, the indicies are mismatched. * In the extreme case, annotated_snippet may try to access out-of-range indices, and panic. * This change is based on the code review by camsteffen on PR #5039 by karyon: have rustfmt internally replace tabs with the corresponding number of spaces, so that columns/indices in the buffer passed to annotated_snippet are counted (unambiguously and) the same.
- Loading branch information