Skip to content

Commit 50d6d4d

Browse files
committed
asm: When pretty-printing, don't escape characters twice
pprust uses `print_string` to write out the template string, and `print_string` already calls `escape_debug`, so `impl fmt::Display for InlineAsmTemplatePiece` shouldn't do an additional `escape_debug`. This fixes a pretty-printing bug that translated `asm!("...\n...")` to `asm!("...\\n...")`
1 parent 840176a commit 50d6d4d

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/librustc_ast/ast.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1914,7 +1914,7 @@ impl fmt::Display for InlineAsmTemplatePiece {
19141914
match c {
19151915
'{' => f.write_str("{{")?,
19161916
'}' => f.write_str("}}")?,
1917-
_ => write!(f, "{}", c.escape_debug())?,
1917+
_ => c.fmt(f)?,
19181918
}
19191919
}
19201920
Ok(())

0 commit comments

Comments
 (0)