File tree 4 files changed +40
-10
lines changed
4 files changed +40
-10
lines changed Original file line number Diff line number Diff line change @@ -298,10 +298,10 @@ where
298
298
}
299
299
let tail = & tail[ first_non_space..] ;
300
300
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 ;
304
301
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 ;
305
305
callback ( start..end, Err ( EscapeError :: UnskippedWhitespaceWarning ) ) ;
306
306
}
307
307
}
Original file line number Diff line number Diff line change @@ -709,7 +709,7 @@ parse_zero_chars = empty character literal
709
709
parse_lone_slash = invalid trailing slash in literal
710
710
.label = { parse_lone_slash }
711
711
712
- parse_unskipped_whitespace = non-ASCII whitespace symbol '{ $ch } ' is not skipped
712
+ parse_unskipped_whitespace = whitespace symbol '{ $ch } ' is not skipped
713
713
.label = { parse_unskipped_whitespace }
714
714
715
715
parse_multiple_skipped_lines = multiple lines skipped by escaped newline
Original file line number Diff line number Diff line change 1
1
// check-pass
2
+ // ignore-tidy-tab
3
+
2
4
fn main ( ) {
3
5
let s = "\
4
6
5
7
" ;
6
8
//~^^^ WARNING multiple lines skipped by escaped newline
9
+ assert_eq ! ( s, "" ) ;
10
+
7
11
let s = "foo\
8
12
bar
9
13
" ;
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" ) ;
11
31
}
Original file line number Diff line number Diff line change 1
1
warning: multiple lines skipped by escaped newline
2
- --> $DIR/str-escape.rs:3 :14
2
+ --> $DIR/str-escape.rs:5 :14
3
3
|
4
4
LL | let s = "\
5
5
| ______________^
6
6
LL | |
7
7
LL | | ";
8
8
| |_____________^ skipping everything up to and including this point
9
9
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
12
12
|
13
13
LL | let s = "foo\
14
14
| _________________^
15
15
LL | | bar
16
- | | ^ non-ASCII whitespace symbol '\u{a0}' is not skipped
16
+ | | ^ whitespace symbol '\u{a0}' is not skipped
17
17
| |___|
18
18
|
19
19
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
21
31
You can’t perform that action at this time.
0 commit comments