This repository was archived by the owner on May 28, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 4 files changed +40
-10
lines changed Expand file tree Collapse file tree 4 files changed +40
-10
lines changed Original file line number Diff line number Diff line change @@ -298,10 +298,10 @@ where
298298 }
299299 let tail = & tail[ first_non_space..] ;
300300 if let Some ( c) = tail. chars ( ) . nth ( 0 ) {
301- // For error reporting, we would like the span to contain the character that was not
302- // skipped. The +1 is necessary to account for the leading \ that started the escape.
303- let end = start + first_non_space + c. len_utf8 ( ) + 1 ;
304301 if c. is_whitespace ( ) {
302+ // For error reporting, we would like the span to contain the character that was not
303+ // skipped. The +1 is necessary to account for the leading \ that started the escape.
304+ let end = start + first_non_space + c. len_utf8 ( ) + 1 ;
305305 callback ( start..end, Err ( EscapeError :: UnskippedWhitespaceWarning ) ) ;
306306 }
307307 }
Original file line number Diff line number Diff line change @@ -710,7 +710,7 @@ parse_zero_chars = empty character literal
710710parse_lone_slash = invalid trailing slash in literal
711711 .label = { parse_lone_slash }
712712
713- parse_unskipped_whitespace = non-ASCII whitespace symbol '{ $ch } ' is not skipped
713+ parse_unskipped_whitespace = whitespace symbol '{ $ch } ' is not skipped
714714 .label = { parse_unskipped_whitespace }
715715
716716parse_multiple_skipped_lines = multiple lines skipped by escaped newline
Original file line number Diff line number Diff line change 11// check-pass
2+ // ignore-tidy-tab
3+
24fn main ( ) {
35 let s = "\
46
57 " ;
68 //~^^^ WARNING multiple lines skipped by escaped newline
9+ assert_eq ! ( s, "" ) ;
10+
711 let s = "foo\
812 bar
913 " ;
10- //~^^^ WARNING non-ASCII whitespace symbol '\u{a0}' is not skipped
14+ //~^^^ WARNING whitespace symbol '\u{a0}' is not skipped
15+ assert_eq ! ( s, "foo bar\n " ) ;
16+
17+ let s = "a\
18+ b";
19+ assert_eq ! ( s, "ab" ) ;
20+
21+ let s = "a\
22+ b";
23+ assert_eq ! ( s, "ab" ) ;
24+
25+ let s = "a\
26+ b";
27+ //~^^ WARNING whitespace symbol '\u{c}' is not skipped
28+ // '\x0c' is ASCII whitespace, but it may not need skipped
29+ // discussion: https://github.com/rust-lang/rust/pull/108403
30+ assert_eq ! ( s, "a\x0c b" ) ;
1131}
Original file line number Diff line number Diff line change 11warning: multiple lines skipped by escaped newline
2- --> $DIR/str-escape.rs:3 :14
2+ --> $DIR/str-escape.rs:5 :14
33 |
44LL | let s = "\
55 | ______________^
66LL | |
77LL | | ";
88 | |_____________^ skipping everything up to and including this point
99
10- warning: non-ASCII whitespace symbol '\u{a0}' is not skipped
11- --> $DIR/str-escape.rs:7 :17
10+ warning: whitespace symbol '\u{a0}' is not skipped
11+ --> $DIR/str-escape.rs:11 :17
1212 |
1313LL | let s = "foo\
1414 | _________________^
1515LL | | bar
16- | | ^ non-ASCII whitespace symbol '\u{a0}' is not skipped
16+ | | ^ whitespace symbol '\u{a0}' is not skipped
1717 | |___|
1818 |
1919
20- warning: 2 warnings emitted
20+ warning: whitespace symbol '\u{c}' is not skipped
21+ --> $DIR/str-escape.rs:25:15
22+ |
23+ LL | let s = "a\
24+ | _______________^
25+ LL | | b";
26+ | | ^- whitespace symbol '\u{c}' is not skipped
27+ | |____|
28+ |
29+
30+ warning: 3 warnings emitted
2131
You can’t perform that action at this time.
0 commit comments