Skip to content

Commit 3edeac0

Browse files
committed
Pass StableSourceFileId.
1 parent 4b417c1 commit 3edeac0

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

compiler/rustc_span/src/source_map.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -262,10 +262,9 @@ impl SourceMap {
262262

263263
fn register_source_file(
264264
&self,
265+
file_id: StableSourceFileId,
265266
mut file: SourceFile,
266267
) -> Result<Lrc<SourceFile>, OffsetOverflowError> {
267-
let file_id = StableSourceFileId::new(&file);
268-
269268
let mut files = self.files.borrow_mut();
270269

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

316-
self.register_source_file(source_file)
315+
self.register_source_file(file_id, source_file)
317316
}
318317
}
319318
}
@@ -355,7 +354,8 @@ impl SourceMap {
355354
cnum,
356355
};
357356

358-
self.register_source_file(source_file)
357+
let file_id = StableSourceFileId::new(&source_file);
358+
self.register_source_file(file_id, source_file)
359359
.expect("not enough address space for imported source file")
360360
}
361361

0 commit comments

Comments
 (0)