about summary refs log tree commit diff
path: root/compiler/rustc_span/src/source_map.rs
diff options
context:
space:
mode:
authorCamille GILLOT <gillot.camille@gmail.com>2023-09-04 16:02:28 +0000
committerCamille GILLOT <gillot.camille@gmail.com>2023-09-04 16:02:46 +0000
commit3edeac06a5722e9b29c350a22e54b8cc1396c62d (patch)
tree2508ce9f65931fbb42ba83e992b2180d5a7face0 /compiler/rustc_span/src/source_map.rs
parent4b417c1b8d74d40fe426c2de384a2c12e9f560a1 (diff)
downloadrust-3edeac06a5722e9b29c350a22e54b8cc1396c62d.tar.gz
rust-3edeac06a5722e9b29c350a22e54b8cc1396c62d.zip
Pass StableSourceFileId.
Diffstat (limited to 'compiler/rustc_span/src/source_map.rs')
-rw-r--r--compiler/rustc_span/src/source_map.rs8
1 files changed, 4 insertions, 4 deletions
diff --git a/compiler/rustc_span/src/source_map.rs b/compiler/rustc_span/src/source_map.rs
index 50c30a079b4..81730f2f608 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<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")
     }