Skip to content

Commit

Permalink
Do not intern filemap to entry w/ mismatched length. Fix #37274 (I th…
Browse files Browse the repository at this point in the history
…ink).
  • Loading branch information
pnkfelix committed Oct 28, 2016
1 parent c40fad3 commit 3f639a0
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/librustc_metadata/decoder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
3 changes: 3 additions & 0 deletions src/libsyntax_pos/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}
Expand Down

0 comments on commit 3f639a0

Please sign in to comment.