diff options
| author | Michael Woerister <michaelwoerister@posteo> | 2017-11-24 14:00:33 +0100 |
|---|---|---|
| committer | Michael Woerister <michaelwoerister@posteo> | 2017-12-01 13:48:19 +0100 |
| commit | 45439945c9cb1122c882cefbe0e38c3bb6f20514 (patch) | |
| tree | 32f823eec65f8b4de4f12e49eafbd41c55f51e4b /src/libsyntax_pos | |
| parent | 409e39285d2189eb8bb656a93074473f9f186cc5 (diff) | |
| download | rust-45439945c9cb1122c882cefbe0e38c3bb6f20514.tar.gz rust-45439945c9cb1122c882cefbe0e38c3bb6f20514.zip | |
incr.comp.: Store Spans as (file,line,col,length) in incr.comp. cache.
The previous method ran into problems because ICH would treat Spans as (file,line,col) but the cache contained byte offsets and its possible for the latter to change while the former stayed stable.
Diffstat (limited to 'src/libsyntax_pos')
| -rw-r--r-- | src/libsyntax_pos/lib.rs | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/libsyntax_pos/lib.rs b/src/libsyntax_pos/lib.rs index 47755dc1d54..bf059cac891 100644 --- a/src/libsyntax_pos/lib.rs +++ b/src/libsyntax_pos/lib.rs @@ -931,6 +931,11 @@ impl FileMap { (lines[line_index], lines[line_index + 1]) } } + + #[inline] + pub fn contains(&self, byte_pos: BytePos) -> bool { + byte_pos >= self.start_pos && byte_pos <= self.end_pos + } } /// Remove utf-8 BOM if any. |
