Do not intern filemap to entry w/ mismatched length. Fix #37274 (I think).

This commit is contained in:
Felix S. Klock II 2016-10-28 17:12:54 +02:00
parent c40fad34e2
commit 3f639a0f11
2 changed files with 7 additions and 0 deletions

View file

@ -1207,6 +1207,10 @@ impl<'a, 'tcx> CrateMetadata {
}
fn are_equal_modulo_startpos(fm1: &syntax_pos::FileMap, fm2: &syntax_pos::FileMap) -> bool {
if fm1.byte_length() != fm2.byte_length() {
return false;
}
if fm1.name != fm2.name {
return false;
}

View file

@ -481,6 +481,9 @@ impl FileMap {
self.src.is_none()
}
pub fn byte_length(&self) -> u32 {
self.end_pos.0 - self.start_pos.0
}
pub fn count_lines(&self) -> usize {
self.lines.borrow().len()
}