From 3edeac06a5722e9b29c350a22e54b8cc1396c62d Mon Sep 17 00:00:00 2001 From: Camille GILLOT Date: Mon, 4 Sep 2023 16:02:28 +0000 Subject: [PATCH] Pass StableSourceFileId. --- compiler/rustc_span/src/source_map.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/compiler/rustc_span/src/source_map.rs b/compiler/rustc_span/src/source_map.rs index 50c30a079b457..81730f2f60869 100644 --- a/compiler/rustc_span/src/source_map.rs +++ b/compiler/rustc_span/src/source_map.rs @@ -262,10 +262,9 @@ impl SourceMap { fn register_source_file( &self, + file_id: StableSourceFileId, mut file: SourceFile, ) -> Result, 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") }