Use Freeze for SourceFile.lines

This commit is contained in:
John Kåre Alsaker 2023-08-31 22:12:47 +02:00
parent d4f12a5ed3
commit 4ecfd30a86

View File

@ -81,7 +81,7 @@ pub(crate) fn get_span_loc(
match tcx.sess.source_map().lookup_line(span.lo()) {
Ok(SourceFileAndLine { sf: file, line }) => {
let line_pos = file.lines(|lines| lines[line]);
let line_pos = file.lines()[line];
let col = file.relative_position(span.lo()) - line_pos;
(file, u64::try_from(line).unwrap() + 1, u64::from(col.to_u32()) + 1)