Pass StableSourceFileId.

This commit is contained in:
Camille GILLOT 2023-09-04 16:02:28 +00:00
parent 4b417c1b8d
commit 3edeac06a5

View File

@ -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() {
@ -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)
}
}
}
@ -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")
}