Commit graph

11 commits

Author SHA1 Message Date
Mark Rousskov
a06baa56b9 Format the world 2019-12-22 17:42:47 -05:00
AnthonyMikh
4414068cc4
Correctly estimate required space for string
`.len()` returns length in bytes so it overestimates the required space
2019-10-05 03:08:05 +03:00
Taiki Endo
950fe6686d librustc_errors => 2018 2019-02-07 03:53:01 +09:00
Mark Rousskov
2a663555dd Remove licenses 2018-12-25 21:08:33 -07:00
Esteban Küber
871856e831 Highlight code on diagnostics when underlined 2018-01-28 17:15:15 -08:00
Esteban Küber
9d80e2200a Display \t in diagnostics code as four spaces 2017-11-24 08:24:31 -08:00
est31
d58281097a Fix mispositioned error indicators
Fixes #38384

Most of the Rust community uses 4 spaces for indentation,
but there are also tab users of Rust (including myself!).

This patch fixes a bug in error printing which mispositions
error indicators when near code with tabs.

The code attempted to fix the issue by replacing spaces
with tabs, but it sadly wasn't enough, as sometimes
you may not print spaces but _ or ^ instead.

This patch employs the reverse strategy: it replaces each
tab with a space, so that the number of _ and ^ and spaces
in error indicators below the code snippet line up
perfectly.

In a study [1] preceeding this patch, we could see that
this strategy is also chosen by gcc version 6.3.0.

Its not perfect, as the output is not beautiful, but its
the easiest to implement. If anyone wants to improve on
this, be my guest! This patch is meant as improvement of
the status quo, not as perfect end status. It fixes the
actual issue of mispositioning error indicators.

[1]: https://github.com/rust-lang/rust/issues/38384#issuecomment-326813710
2017-09-07 10:26:27 +02:00
Kevin Mehall
17bd76a516 Remove unused code from librustc_errors 2017-07-06 18:49:32 -07:00
Srinivas Reddy Thatiparthy
b260617345
run rustfmt on librustc_errors folder 2016-10-18 23:13:02 +05:30
Jonathan Turner
1fd014a965 Add fix for tabs. Move error unit tests->ui tests 2016-07-14 07:57:46 -04:00
Jonathan Turner
2e8e73cb95 Add in styled_buffer.rs and remove some unused code 2016-07-14 07:57:46 -04:00