about summary refs log tree commit diff
path: root/src/libstd/sys
diff options
context:
space:
mode:
authorFelix S. Klock II <pnkfelix@pnkfx.org>2015-04-30 10:23:50 +0200
committerFelix S. Klock II <pnkfelix@pnkfx.org>2015-05-05 12:51:09 +0200
commit939e4c9ea9e63b4da1033d66a72a044279036e6f (patch)
tree167acffb65c6cf5ce3111cf1234453a744bf03e6 /src/libstd/sys
parent42cb2de1393b067f1078f0c8b55322620e6058ef (diff)
downloadrust-939e4c9ea9e63b4da1033d66a72a044279036e6f.tar.gz
rust-939e4c9ea9e63b4da1033d66a72a044279036e6f.zip
Guard against overflow in `codemap::span_to_lines`.
Make `span_to_lines` to return a `Result`.
(This is better than just asserting internally, since it allows caller
to decide if they can recover from the problem.)

Added type alias for `FileLinesResult` returned by `span_to_lines`.

Update embedded unit test to reflect `span_to_lines` signature change.

In diagnostic, catch `Err` from `span_to_lines` and print
`"(internal compiler error: unprintable span)"` instead.

----

There a number of recent issues that report the bug here.  See
e.g. #24761 and #24954.

This change *might* fix them. However, that is not its main goal.
The main goals are:

 1. Make it possible for callers to recover from an error here, and

 2. Insert a more conservative check, in that we are
    also checking that the files match up.
Diffstat (limited to 'src/libstd/sys')
0 files changed, 0 insertions, 0 deletions