Skip to content

Commit a77a65c

Browse files
committed
Print future breakage report
1 parent 6bdb4e3 commit a77a65c

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

src/tools/compiletest/src/json.rs

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,13 @@ pub fn extract_rendered(output: &str) -> String {
8686
if line.starts_with('{') {
8787
if let Ok(diagnostic) = serde_json::from_str::<Diagnostic>(line) {
8888
diagnostic.rendered
89+
} else if let Ok(report) = serde_json::from_str::<FutureIncompatReport>(line) {
90+
Some(format!("Future incompatibility report: {}",
91+
report.future_incompat_report.into_iter().map(|item| {
92+
format!("Future breakage date: {}, diagnostic:\n{}",
93+
item.future_breakage_date.unwrap_or_else(|| "None".to_string()),
94+
item.diagnostic.rendered.unwrap_or_else(|| "Not rendered".to_string()))
95+
}).collect::<String>()))
8996
} else if serde_json::from_str::<ArtifactNotification>(line).is_ok() {
9097
// Ignore the notification.
9198
None
@@ -105,14 +112,10 @@ pub fn extract_rendered(output: &str) -> String {
105112
}
106113

107114
pub fn parse_output(file_name: &str, output: &str, proc_res: &ProcRes) -> Vec<Error> {
108-
let lines = output.lines();
109-
let last_line = lines.next_back();
110-
lines.flat_map(|line| parse_line(file_name, line, output, proc_res, false)).chain(
111-
last_line.into_iter().flat_map(|line| parse_line(file_name, line, output, proc_res, true))
112-
).collect()
115+
output.lines().flat_map(|line| parse_line(file_name, line, output, proc_res)).collect()
113116
}
114117

115-
fn parse_line(file_name: &str, line: &str, output: &str, proc_res: &ProcRes, last_line: bool) -> Vec<Error> {
118+
fn parse_line(file_name: &str, line: &str, output: &str, proc_res: &ProcRes) -> Vec<Error> {
116119
// The compiler sometimes intermingles non-JSON stuff into the
117120
// output. This hack just skips over such lines. Yuck.
118121
if line.starts_with('{') {

0 commit comments

Comments
 (0)