File tree Expand file tree Collapse file tree 1 file changed +10
-5
lines changed Expand file tree Collapse file tree 1 file changed +10
-5
lines changed Original file line number Diff line number Diff line change @@ -478,10 +478,9 @@ fn cooked_byte_string(mut input: Cursor) -> Result<Cursor, Reject> {
478478 Err ( Reject )
479479}
480480
481- fn raw_string ( input : Cursor ) -> Result < Cursor , Reject > {
482- let mut chars = input. char_indices ( ) ;
481+ fn delimiter_of_raw_string ( input : Cursor ) -> PResult < & str > {
483482 let mut n = 0 ;
484- for ( i, ch) in & mut chars {
483+ for ( i, ch) in input . char_indices ( ) {
485484 match ch {
486485 '"' => {
487486 n = i;
@@ -495,10 +494,16 @@ fn raw_string(input: Cursor) -> Result<Cursor, Reject> {
495494 // https://github.com/rust-lang/rust/pull/95251
496495 return Err ( Reject ) ;
497496 }
497+ Ok ( ( input. advance ( n + 1 ) , & input. rest [ ..n] ) )
498+ }
499+
500+ fn raw_string ( input : Cursor ) -> Result < Cursor , Reject > {
501+ let ( input, delimiter) = delimiter_of_raw_string ( input) ?;
502+ let mut chars = input. char_indices ( ) ;
498503 while let Some ( ( i, ch) ) = chars. next ( ) {
499504 match ch {
500- '"' if input. rest [ i + 1 ..] . starts_with ( & input . rest [ ..n ] ) => {
501- let rest = input. advance ( i + 1 + n ) ;
505+ '"' if input. rest [ i + 1 ..] . starts_with ( delimiter ) => {
506+ let rest = input. advance ( i + 1 + delimiter . len ( ) ) ;
502507 return Ok ( literal_suffix ( rest) ) ;
503508 }
504509 '\r' => match chars. next ( ) {
You can’t perform that action at this time.
0 commit comments