Skip to content

Commit 7dcb1bd

Browse files
committed
Pretty-printing uses CRLF on Windows. Closes #14808.
1 parent 5c96369 commit 7dcb1bd

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/libsyntax/print/pp.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -507,8 +507,13 @@ impl<'a> Printer<'a> {
507507
}
508508
}
509509
pub fn print_newline(&mut self, amount: isize) -> io::Result<()> {
510+
let newline_bytes = if cfg!(windows) {
511+
b"\r\n"
512+
} else {
513+
b"\n"
514+
};
510515
debug!("NEWLINE {}", amount);
511-
let ret = write!(self.out, "\n");
516+
let ret = self.out.write_all(newline_bytes);
512517
self.pending_indentation = 0;
513518
self.indent(amount);
514519
return ret;

0 commit comments

Comments
 (0)