@@ -906,8 +906,9 @@ impl<'a> StringReader<'a> {
906
906
// Byte offsetting here is okay because the
907
907
// character before position `start` are an
908
908
// ascii single quote and ascii 'b'.
909
+ let last_pos = self_. last_pos ;
909
910
self_. fatal_span_verbose (
910
- start - BytePos ( 2 ) , self_ . last_pos ,
911
+ start - BytePos ( 2 ) , last_pos,
911
912
"unterminated byte constant" . to_string ( ) ) ;
912
913
}
913
914
self_. bump ( ) ; // advance curr past token
@@ -920,7 +921,8 @@ impl<'a> StringReader<'a> {
920
921
let mut value = Vec :: new ( ) ;
921
922
while !self_. curr_is ( '"' ) {
922
923
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,
924
926
"unterminated double quote byte string" ) ;
925
927
}
926
928
@@ -944,20 +946,25 @@ impl<'a> StringReader<'a> {
944
946
}
945
947
946
948
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" ) ;
948
951
} 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,
950
955
"only `#` is allowed in raw string delimitation; \
951
956
found illegal character",
952
- self_ . curr . unwrap ( ) ) ;
957
+ ch ) ;
953
958
}
954
959
self_. bump ( ) ;
955
960
let content_start_bpos = self_. last_pos ;
956
961
let mut content_end_bpos;
957
962
' outer: loop {
958
963
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
+ } ,
961
968
Some ( '"' ) => {
962
969
content_end_bpos = self_. last_pos ;
963
970
for _ in range ( 0 , hash_count) {
@@ -969,8 +976,9 @@ impl<'a> StringReader<'a> {
969
976
break ;
970
977
} ,
971
978
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) ;
974
982
}
975
983
}
976
984
self_. bump ( ) ;
0 commit comments