Rollup merge of #129049 - Zalathar:json-like, r=jieyouxu
compiletest: Don't panic on unknown JSON-like output lines The `json::extract_rendered` function is called for both compiler output and non-compiler output, so it's inappropriate to panic just because a line starting with `{` didn't contain a compiler output message. It is called from two places: when checking the output of a `ui` test process, and when printing the output of an arbitrary non-passing `ProcRes`. So unfortunately there's currently no easy way to know for sure whether it is seeing compiler output or not. Fortunately, neither call site appears to be relying on this panic; it's just an overzealous internal check. Fixes #126373.
This commit is contained in:
commit
65054ed35e
@ -1,5 +1,4 @@
|
|||||||
//! These structs are a subset of the ones found in `rustc_errors::json`.
|
//! These structs are a subset of the ones found in `rustc_errors::json`.
|
||||||
//! They are only used for deserialization of JSON output provided by libtest.
|
|
||||||
|
|
||||||
use std::path::{Path, PathBuf};
|
use std::path::{Path, PathBuf};
|
||||||
use std::str::FromStr;
|
use std::str::FromStr;
|
||||||
@ -127,11 +126,10 @@ pub fn extract_rendered(output: &str) -> String {
|
|||||||
// Ignore the notification.
|
// Ignore the notification.
|
||||||
None
|
None
|
||||||
} else {
|
} else {
|
||||||
print!(
|
// This function is called for both compiler and non-compiler output,
|
||||||
"failed to decode compiler output as json: line: {}\noutput: {}",
|
// so if the line isn't recognized as JSON from the compiler then
|
||||||
line, output
|
// just print it as-is.
|
||||||
);
|
Some(format!("{line}\n"))
|
||||||
panic!()
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// preserve non-JSON lines, such as ICEs
|
// preserve non-JSON lines, such as ICEs
|
||||||
|
Loading…
Reference in New Issue
Block a user