File tree 5 files changed +7
-6
lines changed
src/test/ui/half-open-range-patterns
5 files changed +7
-6
lines changed Original file line number Diff line number Diff line change @@ -69,7 +69,7 @@ fn test_format_macro_interface() {
69
69
t ! ( format!( "{:?}" , "true" ) , "\" true\" " ) ;
70
70
t ! ( format!( "{:?}" , "foo\n bar" ) , "\" foo\\ nbar\" " ) ;
71
71
t ! ( format!( "{:?}" , "foo\n \" bar\" \r \n \' baz\' \t \\ qux\\ " ) , r#""foo\n\"bar\"\r\n'baz'\t\\qux\\""# ) ;
72
- t ! ( format!( "{:?}" , "foo\0 bar\x01 baz\u{7f} q\u{75} x" ) , r#""foo\u{0}bar \u{1}baz\u{7f}qux""# ) ;
72
+ t ! ( format!( "{:?}" , "foo\0 bar\x01 baz\u{7f} q\u{75} x" ) , r#""foo\0bar \u{1}baz\u{7f}qux""# ) ;
73
73
t ! ( format!( "{:o}" , 10_usize ) , "12" ) ;
74
74
t ! ( format!( "{:x}" , 10_usize ) , "a" ) ;
75
75
t ! ( format!( "{:X}" , 10_usize ) , "A" ) ;
Original file line number Diff line number Diff line change @@ -1116,7 +1116,7 @@ fn test_escape_debug() {
1116
1116
assert_eq ! ( "abc" . escape_debug( ) . to_string( ) , "abc" ) ;
1117
1117
assert_eq ! ( "a c" . escape_debug( ) . to_string( ) , "a c" ) ;
1118
1118
assert_eq ! ( "éèê" . escape_debug( ) . to_string( ) , "éèê" ) ;
1119
- assert_eq ! ( "\r \n \t " . escape_debug( ) . to_string( ) , "\\ r\\ n\\ t" ) ;
1119
+ assert_eq ! ( "\0 \ r\n \t " . escape_debug( ) . to_string( ) , "\\ 0 \\ r\\ n\\ t" ) ;
1120
1120
assert_eq ! ( "'\" \\ " . escape_debug( ) . to_string( ) , "\\ '\\ \" \\ \\ " ) ;
1121
1121
assert_eq ! ( "\u{7f} \u{ff} " . escape_debug( ) . to_string( ) , "\\ u{7f}\u{ff} " ) ;
1122
1122
assert_eq ! ( "\u{100} \u{ffff} " . escape_debug( ) . to_string( ) , "\u{100} \\ u{ffff}" ) ;
Original file line number Diff line number Diff line change @@ -421,6 +421,7 @@ impl char {
421
421
#[ inline]
422
422
pub ( crate ) fn escape_debug_ext ( self , args : EscapeDebugExtArgs ) -> EscapeDebug {
423
423
let init_state = match self {
424
+ '\0' => EscapeDefaultState :: Backslash ( '0' ) ,
424
425
'\t' => EscapeDefaultState :: Backslash ( 't' ) ,
425
426
'\r' => EscapeDefaultState :: Backslash ( 'r' ) ,
426
427
'\n' => EscapeDefaultState :: Backslash ( 'n' ) ,
Original file line number Diff line number Diff line change @@ -197,7 +197,7 @@ fn test_escape_debug() {
197
197
assert_eq ! ( string( '~' ) , "~" ) ;
198
198
assert_eq ! ( string( 'é' ) , "é" ) ;
199
199
assert_eq ! ( string( '文' ) , "文" ) ;
200
- assert_eq ! ( string( '\x00' ) , "\\ u{0} " ) ;
200
+ assert_eq ! ( string( '\x00' ) , "\\ 0 " ) ;
201
201
assert_eq ! ( string( '\x1f' ) , "\\ u{1f}" ) ;
202
202
assert_eq ! ( string( '\x7f' ) , "\\ u{7f}" ) ;
203
203
assert_eq ! ( string( '\u{80}' ) , "\\ u{80}" ) ;
Original file line number Diff line number Diff line change @@ -50,17 +50,17 @@ LL ~ match $s { $($t)+ => {}
50
50
LL ~ '\u{10fffe}'..='\u{10ffff}' => todo!() }
51
51
|
52
52
53
- error[E0004]: non-exhaustive patterns: `'\u{0} '` not covered
53
+ error[E0004]: non-exhaustive patterns: `'\0 '` not covered
54
54
--> $DIR/half-open-range-pats-exhaustive-fail.rs:28:8
55
55
|
56
56
LL | m!('a', ALMOST_MIN..);
57
- | ^^^ pattern `'\u{0} '` not covered
57
+ | ^^^ pattern `'\0 '` not covered
58
58
|
59
59
= note: the matched value is of type `char`
60
60
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
61
61
|
62
62
LL ~ match $s { $($t)+ => {}
63
- LL ~ '\u{0} ' => todo!() }
63
+ LL ~ '\0 ' => todo!() }
64
64
|
65
65
66
66
error[E0004]: non-exhaustive patterns: `'\u{10ffff}'` not covered
You can’t perform that action at this time.
0 commit comments