@@ -906,8 +906,9 @@ impl<'a> StringReader<'a> {
906906 // Byte offsetting here is okay because the
907907 // character before position `start` are an
908908 // ascii single quote and ascii 'b'.
909+ let last_pos = self_. last_pos ;
909910 self_. fatal_span_verbose (
910- start - BytePos ( 2 ) , self_ . last_pos ,
911+ start - BytePos ( 2 ) , last_pos,
911912 "unterminated byte constant" . to_string ( ) ) ;
912913 }
913914 self_. bump ( ) ; // advance curr past token
@@ -920,7 +921,8 @@ impl<'a> StringReader<'a> {
920921 let mut value = Vec :: new ( ) ;
921922 while !self_. curr_is ( '"' ) {
922923 if self_. is_eof ( ) {
923- self_. fatal_span ( start, self_. last_pos ,
924+ let last_pos = self_. last_pos ;
925+ self_. fatal_span ( start, last_pos,
924926 "unterminated double quote byte string" ) ;
925927 }
926928
@@ -944,20 +946,25 @@ impl<'a> StringReader<'a> {
944946 }
945947
946948 if self_. is_eof ( ) {
947- self_. fatal_span ( start_bpos, self_. last_pos , "unterminated raw string" ) ;
949+ let last_pos = self_. last_pos ;
950+ self_. fatal_span ( start_bpos, last_pos, "unterminated raw string" ) ;
948951 } else if !self_. curr_is ( '"' ) {
949- self_. fatal_span_char ( start_bpos, self_. last_pos ,
952+ let last_pos = self_. last_pos ;
953+ let ch = self_. curr . unwrap ( ) ;
954+ self_. fatal_span_char ( start_bpos, last_pos,
950955 "only `#` is allowed in raw string delimitation; \
951956 found illegal character",
952- self_ . curr . unwrap ( ) ) ;
957+ ch ) ;
953958 }
954959 self_. bump ( ) ;
955960 let content_start_bpos = self_. last_pos ;
956961 let mut content_end_bpos;
957962 ' outer: loop {
958963 match self_. curr {
959- None => self_. fatal_span ( start_bpos, self_. last_pos ,
960- "unterminated raw string" ) ,
964+ None => {
965+ let last_pos = self_. last_pos ;
966+ self_. fatal_span ( start_bpos, last_pos, "unterminated raw string" )
967+ } ,
961968 Some ( '"' ) => {
962969 content_end_bpos = self_. last_pos ;
963970 for _ in range ( 0 , hash_count) {
@@ -969,8 +976,9 @@ impl<'a> StringReader<'a> {
969976 break ;
970977 } ,
971978 Some ( c) => if c > '\x7F' {
972- self_. err_span_char ( self_. last_pos , self_. last_pos ,
973- "raw byte string must be ASCII" , c) ;
979+ let last_pos = self_. last_pos ;
980+ self_. err_span_char (
981+ last_pos, last_pos, "raw byte string must be ASCII" , c) ;
974982 }
975983 }
976984 self_. bump ( ) ;
0 commit comments