Description
This is a follow-up of #38384 which was fixed by my PR #44386. The basic question: how to handle tabs in error messages? E.g. you want to underline something with ^
or you show markers like __^
. The problem is that you don't know which tab width the viewer has (whether its a terminal or an online tool like travis or a text editor if you've stored the output into a file and now opened it), so you might end up producing misaligned output if you just copy the tabs.
The strategy chosen before my PR was trying to replicate tabs in the line below, but it still misaligned when the underlined stuff has tabs of its own, and it also didn't really work in other cases.
Now my PR has fixed the misalignment by implementing GCC's (very simple) fix to the problem, replacing each tab with one space in the code printed. But the output is still not beautiful. A better strategy is the one clang uses, which emulates a tabstop algorithm by filling in spaces in place of tabs, with a tabstop existing at all 4 spaces.
I've opened this issue to remember that adopting clang's strategy might be something worth pursuing for rustc.