File tree Expand file tree Collapse file tree 5 files changed +7
-6
lines changed
src/test/ui/half-open-range-patterns Expand file tree Collapse file tree 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() {
6969 t ! ( format!( "{:?}" , "true" ) , "\" true\" " ) ;
7070 t ! ( format!( "{:?}" , "foo\n bar" ) , "\" foo\\ nbar\" " ) ;
7171 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""# ) ;
7373 t ! ( format!( "{:o}" , 10_usize ) , "12" ) ;
7474 t ! ( format!( "{:x}" , 10_usize ) , "a" ) ;
7575 t ! ( format!( "{:X}" , 10_usize ) , "A" ) ;
Original file line number Diff line number Diff line change @@ -1116,7 +1116,7 @@ fn test_escape_debug() {
11161116 assert_eq ! ( "abc" . escape_debug( ) . to_string( ) , "abc" ) ;
11171117 assert_eq ! ( "a c" . escape_debug( ) . to_string( ) , "a c" ) ;
11181118 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" ) ;
11201120 assert_eq ! ( "'\" \\ " . escape_debug( ) . to_string( ) , "\\ '\\ \" \\ \\ " ) ;
11211121 assert_eq ! ( "\u{7f} \u{ff} " . escape_debug( ) . to_string( ) , "\\ u{7f}\u{ff} " ) ;
11221122 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 {
421421 #[ inline]
422422 pub ( crate ) fn escape_debug_ext ( self , args : EscapeDebugExtArgs ) -> EscapeDebug {
423423 let init_state = match self {
424+ '\0' => EscapeDefaultState :: Backslash ( '0' ) ,
424425 '\t' => EscapeDefaultState :: Backslash ( 't' ) ,
425426 '\r' => EscapeDefaultState :: Backslash ( 'r' ) ,
426427 '\n' => EscapeDefaultState :: Backslash ( 'n' ) ,
Original file line number Diff line number Diff line change @@ -197,7 +197,7 @@ fn test_escape_debug() {
197197 assert_eq ! ( string( '~' ) , "~" ) ;
198198 assert_eq ! ( string( 'é' ) , "é" ) ;
199199 assert_eq ! ( string( '文' ) , "文" ) ;
200- assert_eq ! ( string( '\x00' ) , "\\ u{0} " ) ;
200+ assert_eq ! ( string( '\x00' ) , "\\ 0 " ) ;
201201 assert_eq ! ( string( '\x1f' ) , "\\ u{1f}" ) ;
202202 assert_eq ! ( string( '\x7f' ) , "\\ u{7f}" ) ;
203203 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)+ => {}
5050LL ~ '\u{10fffe}'..='\u{10ffff}' => todo!() }
5151 |
5252
53- error[E0004]: non-exhaustive patterns: `'\u{0} '` not covered
53+ error[E0004]: non-exhaustive patterns: `'\0 '` not covered
5454 --> $DIR/half-open-range-pats-exhaustive-fail.rs:28:8
5555 |
5656LL | m!('a', ALMOST_MIN..);
57- | ^^^ pattern `'\u{0} '` not covered
57+ | ^^^ pattern `'\0 '` not covered
5858 |
5959 = note: the matched value is of type `char`
6060help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
6161 |
6262LL ~ match $s { $($t)+ => {}
63- LL ~ '\u{0} ' => todo!() }
63+ LL ~ '\0 ' => todo!() }
6464 |
6565
6666error[E0004]: non-exhaustive patterns: `'\u{10ffff}'` not covered
You can’t perform that action at this time.
0 commit comments