File tree 3 files changed +33
-2
lines changed
compiler/rustc_ast_pretty/src/pprust/state
3 files changed +33
-2
lines changed Original file line number Diff line number Diff line change @@ -684,8 +684,8 @@ pub fn reconstruct_format_args_template_string(pieces: &[FormatArgsPiece]) -> St
684
684
for piece in pieces {
685
685
match piece {
686
686
FormatArgsPiece :: Literal ( s) => {
687
- for c in s. as_str ( ) . escape_debug ( ) {
688
- template. push ( c ) ;
687
+ for c in s. as_str ( ) . chars ( ) {
688
+ template. extend ( c . escape_debug ( ) ) ;
689
689
if let '{' | '}' = c {
690
690
template. push ( c) ;
691
691
}
Original file line number Diff line number Diff line change
1
+ # ![feature(prelude_import)]
2
+ # ![no_std]
3
+ # [prelude_import]
4
+ use ::std::prelude::rust_2015::*;
5
+ # [macro_use]
6
+ extern crate std;
7
+ // pretty-compare-only
8
+ // pretty-mode:expanded
9
+ // pp-exact:format-args-str-escape .pp
10
+
11
+ fn main() {
12
+ { ::std::io::_print(format_args!(" \u {1b}[1mHello, world!\u {1b}[0m\n " )); };
13
+ { ::std::io::_print(format_args!(" \u {1b}[1mHello, world!\u {1b}[0m\n " )); };
14
+ {
15
+ ::std::io::_print(format_args!(" Not an escape sequence: \\ u{{1B}}[1mbold\\ x1B[0m\n " ));
16
+ };
17
+ {
18
+ ::std::io::_print(format_args!(" {0}\n " ,
19
+ " \x 1B[1mHello, world!\x 1B[0m" ));
20
+ };
21
+ }
Original file line number Diff line number Diff line change
1
+ // pretty-compare-only
2
+ // pretty-mode:expanded
3
+ // pp-exact:format-args-str-escape.pp
4
+
5
+ fn main ( ) {
6
+ println ! ( "\x1B [1mHello, world!\x1B [0m" ) ;
7
+ println ! ( "\u{1B} [1mHello, world!\u{1B} [0m" ) ;
8
+ println ! ( "Not an escape sequence: \\ u{{1B}}[1mbold\\ x1B[0m" ) ;
9
+ println ! ( "{}" , "\x1B [1mHello, world!\x1B [0m" ) ;
10
+ }
You can’t perform that action at this time.
0 commit comments