diff options
| author | bors <bors@rust-lang.org> | 2023-06-30 00:35:19 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2023-06-30 00:35:19 +0000 |
| commit | 8aed93d912ec23819c08e9a89ca1fb461b3cd2e6 (patch) | |
| tree | cf08613768e315951133c7494e2487cebd22c598 /compiler/rustc_span/src | |
| parent | 330727467b8fdf2c43b95095a0efae7012c4f83b (diff) | |
| parent | 7e786e81b00cf48a664084d30d4f82f408825397 (diff) | |
| download | rust-8aed93d912ec23819c08e9a89ca1fb461b3cd2e6.tar.gz rust-8aed93d912ec23819c08e9a89ca1fb461b3cd2e6.zip | |
Auto merge of #113116 - nnethercote:codegen-opts, r=oli-obk
A mish-mash of micro-optimizations These were aimed at speeding up LLVM codegen, but ended up affecting other places as well. r? `@bjorn3`
Diffstat (limited to 'compiler/rustc_span/src')
| -rw-r--r-- | compiler/rustc_span/src/source_map.rs | 6 |
1 files changed, 1 insertions, 5 deletions
diff --git a/compiler/rustc_span/src/source_map.rs b/compiler/rustc_span/src/source_map.rs index c53fe084c4d..86716da1712 100644 --- a/compiler/rustc_span/src/source_map.rs +++ b/compiler/rustc_span/src/source_map.rs @@ -1072,11 +1072,7 @@ impl SourceMap { /// This index is guaranteed to be valid for the lifetime of this `SourceMap`, /// since `source_files` is a `MonotonicVec` pub fn lookup_source_file_idx(&self, pos: BytePos) -> usize { - self.files - .borrow() - .source_files - .binary_search_by_key(&pos, |key| key.start_pos) - .unwrap_or_else(|p| p - 1) + self.files.borrow().source_files.partition_point(|x| x.start_pos <= pos) - 1 } pub fn count_lines(&self) -> usize { |
