Skip to content

Commit 121c8ce

Browse files
committed
Pretty-printing uses CRLF on Windows. Closes #14808.
1 parent 3dbfa74 commit 121c8ce

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

Diff for: src/libsyntax/print/pp.rs

+7-1
Original file line numberDiff line numberDiff line change
@@ -507,8 +507,14 @@ impl<'a> Printer<'a> {
507507
}
508508
}
509509
pub fn print_newline(&mut self, amount: isize) -> io::Result<()> {
510+
#[cfg(windows)]
511+
const NEWLINE: &'static str = "\r\n";
512+
513+
#[cfg(not(windows))]
514+
const NEWLINE: &'static str = "\n";
515+
510516
debug!("NEWLINE {}", amount);
511-
let ret = write!(self.out, "\n");
517+
let ret = self.out.write_all(NEWLINE.as_bytes());
512518
self.pending_indentation = 0;
513519
self.indent(amount);
514520
return ret;

0 commit comments

Comments
 (0)