Skip to content

Commit

Permalink
Auto merge of #115418 - Zoxc:freeze-source, r=oli-obk
Browse files Browse the repository at this point in the history
Use `Freeze` for `SourceFile`

This uses the `Freeze` type in `SourceFile` to let accessing `external_src` and `lines` be lock-free.

Behavior of `add_external_src` is changed to set `ExternalSourceKind::AbsentErr` on a hash mismatch which matches the documentation. `ExternalSourceKind::Unneeded` was removed as it's unused.

Based on rust-lang/rust#115401.
  • Loading branch information
bors committed Sep 8, 2023
2 parents 6285086 + 4ecfd30 commit c41e779
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/debuginfo/line_info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ impl DebugContext {

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)
Expand Down

0 comments on commit c41e779

Please sign in to comment.