Syntax highlighting in all compiler output?

By that logic, the compiler should also include i13n & i18n since it’ll make the error messages more approachable to international users. Should we than stick a complex translation system in the compiler as well? Sure, it’ll come with “just” the very conservative default (English) but the infrastructure itself must then be part of the compiler’s code base…

Edit: of course if we go by that route, we’ll have in addition to these ridiculous color debates also debates about which spelling should be default, British English or American English…

My point is that this is already there: the compiler already uses colorized terminal output and the code to highlight syntax is there because of rustdoc. The PR that enables this less than new 200 lines, and could have been fewer. The only problem I see with the feature as it stands is the lack of configurability, which is why I feel strongly that the highlighting should be pretty minimal.

Adding i18n to the compiler has been discussed before and it is a huge undertaking with multiple pitfalls. Even then, doing so hasn't been rejected outright, the conclusion from the threads about it I've seen has been "not now".

Hm, I'd quite welcome that?

This is already decided (I'm in a rush, so I can't dig it out). Sadly, it's AE.

My only concern with the idea of syntax highlighting all code in compiler output is that the colorized output we already have might become less effective. In particular, messages pointing at multiline code spans are legible in large part because the arrows pointing at the start and end of the span are colored and the actual code is not.

If we reserve the “most eyecatching” colors for the non-code parts of the output (i.e., what we colorize today), how many “portable colors” would we have left over to do syntax highlighting with? Your test screenshots (from Syntax highlighting in all compiler output?) look excellent to me, but they do appear to be “just code”. Could we see some more complex examples, e.g. a full cargo build run that results in an error message with multiline spans?


And let’s try to avoid debating whether the compiler does or should follow certain philosophies or whether completely unrelated features like internationalized output should be implemented. Arguing those points here is, at best, a distraction.

1 Like

Has there been any developments since PR 39300?

Since then the syntax colorizer that rustdoc uses has changed and I haven’t pushed to update my PR. I can help anyone that wants to pick it up and drive it to completion.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.