about summary refs log tree commit diff
path: root/src/rustllvm/ExecutionEngineWrapper.cpp
diff options
context:
space:
mode:
authorDmitry Promsky <dmitry@willworkforcookies.com>2014-03-03 14:44:43 +0400
committerDmitry Promsky <dmitry@willworkforcookies.com>2014-03-10 02:28:04 +0400
commit43a8f7b3e90784ae9e4237a07913f2c5d2bd1631 (patch)
treebbc49082113a10574ed8dabe6a3f726bf25145a7 /src/rustllvm/ExecutionEngineWrapper.cpp
parent62f1d68439dcfd509eaca29887afa97f22938373 (diff)
downloadrust-43a8f7b3e90784ae9e4237a07913f2c5d2bd1631.tar.gz
rust-43a8f7b3e90784ae9e4237a07913f2c5d2bd1631.zip
syntax: fixed ICEs and incorrect line nums when reporting Spans at the end of the file.
CodeMap.span_to_* perform a lookup of a BytePos(sp.hi), which lands into the next filemap if the last byte of range denoted by Span is also the last byte of the filemap, which results in ICEs or incorrect error reports.

    Example:
        ````

        pub fn main() {
            let mut num = 3;
            let refe = &mut num;
            *refe = 5;
            println!("{}", num);
        }````

(note the empty line in the beginning and the absence of newline at the end)

The above would have caused ICE when trying to report where "refe" borrow ends.
The above without an empty line in the beginning would have reported borrow end to be the first line.

Most probably, this is also responsible for (at least some occurrences of) issue #8256.

The issue is fixed by always adding a newline at the end of non-empty filemaps in case there isn't a new line there already.
Diffstat (limited to 'src/rustllvm/ExecutionEngineWrapper.cpp')
0 files changed, 0 insertions, 0 deletions