about summary refs log tree commit diff
path: root/src/libstd/sync
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2017-09-13 10:28:33 +0000
committerbors <bors@rust-lang.org>2017-09-13 10:28:33 +0000
commit824952f48b85806c498d700f183dfc42b516cc7d (patch)
tree96ad3e0516cf3375c8e2f18994862a6fa55e0520 /src/libstd/sync
parentc3eccc694c4721c0bfaf3dcddd572e36c62e8fa1 (diff)
parentd58281097a3bf14fe1b199c8ba6aee00793e111e (diff)
downloadrust-824952f48b85806c498d700f183dfc42b516cc7d.tar.gz
rust-824952f48b85806c498d700f183dfc42b516cc7d.zip
Auto merge of #44386 - est31:master, r=pnkfelix
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
Diffstat (limited to 'src/libstd/sync')
0 files changed, 0 insertions, 0 deletions