diff options
| author | bors <bors@rust-lang.org> | 2016-09-06 13:22:35 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2016-09-06 13:22:35 -0700 |
| commit | 923bac45964940c56ab1075fb7980896de1eb620 (patch) | |
| tree | c917d9e5681f15bdb3f7e72e707ce5934875d3f0 /src/libsyntax | |
| parent | 13c4e32e7aca87cbf867be68bf0fc45528bb3fcf (diff) | |
| parent | 3057b7b9749f16ad982b54b4bdeee7e2c8a845bb (diff) | |
| download | rust-923bac45964940c56ab1075fb7980896de1eb620.tar.gz rust-923bac45964940c56ab1075fb7980896de1eb620.zip | |
Auto merge of #36025 - michaelwoerister:incr-comp-hash-spans, r=nikomatsakis
incr. comp.: Take spans into account for ICH This PR makes the ICH (incr. comp. hash) take spans into account when debuginfo is enabled. A side-effect of this is that the SVH (which is based on the ICHs of all items in the crate) becomes sensitive to the tiniest change in a code base if debuginfo is enabled. Since we are not trying to model ABI compatibility via the SVH anymore (this is done via the crate disambiguator now), this should be not be a problem. Fixes #33888. Fixes #32753.
Diffstat (limited to 'src/libsyntax')
| -rw-r--r-- | src/libsyntax/codemap.rs | 24 |
1 files changed, 4 insertions, 20 deletions
diff --git a/src/libsyntax/codemap.rs b/src/libsyntax/codemap.rs index b176b8fefc6..cd6f2874954 100644 --- a/src/libsyntax/codemap.rs +++ b/src/libsyntax/codemap.rs @@ -348,26 +348,10 @@ impl CodeMap { let files = self.files.borrow(); let f = (*files)[idx].clone(); - let len = f.lines.borrow().len(); - if len == 0 { - return Err(f); + match f.lookup_line(pos) { + Some(line) => Ok(FileMapAndLine { fm: f, line: line }), + None => Err(f) } - - let mut a = 0; - { - let lines = f.lines.borrow(); - let mut b = lines.len(); - while b - a > 1 { - let m = (a + b) / 2; - if (*lines)[m] > pos { - b = m; - } else { - a = m; - } - } - assert!(a <= lines.len()); - } - Ok(FileMapAndLine { fm: f, line: a }) } pub fn lookup_char_pos_adj(&self, pos: BytePos) -> LocWithOpt { @@ -691,7 +675,7 @@ impl CodeMap { } // Return the index of the filemap (in self.files) which contains pos. - fn lookup_filemap_idx(&self, pos: BytePos) -> usize { + pub fn lookup_filemap_idx(&self, pos: BytePos) -> usize { let files = self.files.borrow(); let files = &*files; let count = files.len(); |
