We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
partition_point
SourceMap::lookup_source_file_idx
1 parent b4c6e19 commit 45fcd1dCopy full SHA for 45fcd1d
compiler/rustc_span/src/source_map.rs
@@ -1072,11 +1072,7 @@ impl SourceMap {
1072
/// This index is guaranteed to be valid for the lifetime of this `SourceMap`,
1073
/// since `source_files` is a `MonotonicVec`
1074
pub fn lookup_source_file_idx(&self, pos: BytePos) -> usize {
1075
- self.files
1076
- .borrow()
1077
- .source_files
1078
- .binary_search_by_key(&pos, |key| key.start_pos)
1079
- .unwrap_or_else(|p| p - 1)
+ self.files.borrow().source_files.partition_point(|x| x.start_pos <= pos) - 1
1080
}
1081
1082
pub fn count_lines(&self) -> usize {
0 commit comments