diff --git a/src/libsyntax/json.rs b/src/libsyntax/json.rs index d3f69a66557e8..80ac0cb4faf7d 100644 --- a/src/libsyntax/json.rs +++ b/src/libsyntax/json.rs @@ -200,7 +200,7 @@ impl Diagnostic { children: db.children.iter().map(|c| { Diagnostic::from_sub_diagnostic(c, je) }).chain(sugg).collect(), - rendered: Some(output.to_owned()), + rendered: Some(output), } } diff --git a/src/tools/compiletest/src/runtest.rs b/src/tools/compiletest/src/runtest.rs index b74867aba2d74..633f349ba5066 100644 --- a/src/tools/compiletest/src/runtest.rs +++ b/src/tools/compiletest/src/runtest.rs @@ -2411,7 +2411,11 @@ actual:\n\ let mut normalized = output.replace(&parent_dir_str, "$DIR"); if json { - normalized = normalized.replace("\\n", "\n"); // verbatim newline in json strings + // escaped newlines in json strings should be readable + // in the stderr files. There's no point int being correct, + // since only humans process the stderr files. + // Thus we just turn escaped newlines back into newlines. + normalized = normalized.replace("\\n", "\n"); } normalized = normalized.replace("\\\\", "\\") // denormalize for paths on windows