Skip to content

Commit

Permalink
Pass StableSourceFileId.
Browse files Browse the repository at this point in the history
  • Loading branch information
cjgillot committed Sep 4, 2023
1 parent 4b417c1 commit 3edeac0
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions compiler/rustc_span/src/source_map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -262,10 +262,9 @@ impl SourceMap {

fn register_source_file(
&self,
file_id: StableSourceFileId,
mut file: SourceFile,
) -> Result<Lrc<SourceFile>, OffsetOverflowError> {
let file_id = StableSourceFileId::new(&file);

let mut files = self.files.borrow_mut();

file.start_pos = BytePos(if let Some(last_file) = files.source_files.last() {
Expand Down Expand Up @@ -313,7 +312,7 @@ impl SourceMap {
// the ID we generate for the SourceFile we just created.
debug_assert_eq!(StableSourceFileId::new(&source_file), file_id);

self.register_source_file(source_file)
self.register_source_file(file_id, source_file)
}
}
}
Expand Down Expand Up @@ -355,7 +354,8 @@ impl SourceMap {
cnum,
};

self.register_source_file(source_file)
let file_id = StableSourceFileId::new(&source_file);
self.register_source_file(file_id, source_file)
.expect("not enough address space for imported source file")
}

Expand Down

0 comments on commit 3edeac0

Please sign in to comment.