File tree Expand file tree Collapse file tree 3 files changed +25
-1
lines changed
compiler/rustc_parse_format/src Expand file tree Collapse file tree 3 files changed +25
-1
lines changed Original file line number Diff line number Diff line change @@ -736,7 +736,7 @@ fn find_skips_from_snippet(
736736
737737 fn find_skips ( snippet : & str , is_raw : bool ) -> Vec < usize > {
738738 let mut eat_ws = false ;
739- let mut s = snippet. chars ( ) . enumerate ( ) . peekable ( ) ;
739+ let mut s = snippet. char_indices ( ) . peekable ( ) ;
740740 let mut skips = vec ! [ ] ;
741741 while let Some ( ( pos, c) ) = s. next ( ) {
742742 match ( c, s. peek ( ) ) {
Original file line number Diff line number Diff line change 1+ // check-fail
2+
3+ // First format below would cause a panic, second would generate error with incorrect span
4+
5+ fn main ( ) {
6+ let _ = format ! ( "→{}→\n " ) ;
7+ //~^ ERROR 1 positional argument in format string, but no arguments were given
8+ let _ = format ! ( "→{} \n " ) ;
9+ //~^ ERROR 1 positional argument in format string, but no arguments were given
10+ }
Original file line number Diff line number Diff line change 1+ error: 1 positional argument in format string, but no arguments were given
2+ --> $DIR/issue-81006.rs:6:23
3+ |
4+ LL | let _ = format!("→{}→\n");
5+ | ^^
6+
7+ error: 1 positional argument in format string, but no arguments were given
8+ --> $DIR/issue-81006.rs:8:23
9+ |
10+ LL | let _ = format!("→{} \n");
11+ | ^^
12+
13+ error: aborting due to 2 previous errors
14+
You can’t perform that action at this time.
0 commit comments