@@ -596,8 +596,8 @@ impl CodeMap {
596596 pub fn new_imported_filemap ( & self ,
597597 filename : FileName ,
598598 source_len : usize ,
599- file_local_lines : Vec < BytePos > ,
600- file_local_multibyte_chars : Vec < MultiByteChar > )
599+ mut file_local_lines : Vec < BytePos > ,
600+ mut file_local_multibyte_chars : Vec < MultiByteChar > )
601601 -> Rc < FileMap > {
602602 let mut files = self . files . borrow_mut ( ) ;
603603 let start_pos = match files. last ( ) {
@@ -608,19 +608,21 @@ impl CodeMap {
608608 let end_pos = Pos :: from_usize ( start_pos + source_len) ;
609609 let start_pos = Pos :: from_usize ( start_pos) ;
610610
611- let lines = file_local_lines. map_in_place ( |pos| pos + start_pos) ;
612- let multibyte_chars = file_local_multibyte_chars. map_in_place ( |mbc| MultiByteChar {
613- pos : mbc. pos + start_pos,
614- bytes : mbc. bytes
615- } ) ;
611+ for pos in & mut file_local_lines {
612+ * pos = * pos + start_pos;
613+ }
614+
615+ for mbc in & mut file_local_multibyte_chars {
616+ mbc. pos = mbc. pos + start_pos;
617+ }
616618
617619 let filemap = Rc :: new ( FileMap {
618620 name : filename,
619621 src : None ,
620622 start_pos : start_pos,
621623 end_pos : end_pos,
622- lines : RefCell :: new ( lines ) ,
623- multibyte_chars : RefCell :: new ( multibyte_chars ) ,
624+ lines : RefCell :: new ( file_local_lines ) ,
625+ multibyte_chars : RefCell :: new ( file_local_multibyte_chars ) ,
624626 } ) ;
625627
626628 files. push ( filemap. clone ( ) ) ;
0 commit comments