Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
syntax: fixed ICEs and incorrect line nums when reporting Spans at th…
…e 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.
- Loading branch information
Showing
1 changed file
with
58 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43a8f7b
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
saw approval from nick29581
at dmski@43a8f7b
43a8f7b
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
merging dmski/rust/master = 43a8f7b into auto
43a8f7b
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
dmski/rust/master = 43a8f7b merged ok, testing candidate = d75a6ab
43a8f7b
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
all tests pass:
success: http://buildbot.rust-lang.org/builders/auto-mac-32-opt/builds/4646
success: http://buildbot.rust-lang.org/builders/auto-mac-32-nopt-c/builds/2488
success: http://buildbot.rust-lang.org/builders/auto-mac-32-nopt-t/builds/2487
success: http://buildbot.rust-lang.org/builders/auto-mac-64-opt/builds/4643
success: http://buildbot.rust-lang.org/builders/auto-mac-64-nopt-c/builds/3743
success: http://buildbot.rust-lang.org/builders/auto-mac-64-nopt-t/builds/3749
success: http://buildbot.rust-lang.org/builders/auto-linux-32-opt/builds/4658
success: http://buildbot.rust-lang.org/builders/auto-linux-32-nopt-c/builds/3746
success: http://buildbot.rust-lang.org/builders/auto-linux-32-nopt-t/builds/3752
success: http://buildbot.rust-lang.org/builders/auto-linux-64-opt/builds/4660
success: http://buildbot.rust-lang.org/builders/auto-linux-64-nopt-c/builds/3746
success: http://buildbot.rust-lang.org/builders/auto-linux-64-nopt-t/builds/3751
success: http://buildbot.rust-lang.org/builders/auto-linux-64-x-android/builds/3819
success: http://buildbot.rust-lang.org/builders/auto-linux-64-x-android-t/builds/1637
success: http://buildbot.rust-lang.org/builders/auto-win-32-opt/builds/4655
success: http://buildbot.rust-lang.org/builders/auto-win-32-nopt-c/builds/3756
success: http://buildbot.rust-lang.org/builders/auto-win-32-nopt-t/builds/3763
success: http://buildbot.rust-lang.org/builders/auto-bsd-64-opt/builds/4419
43a8f7b
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fast-forwarding master to auto = d75a6ab