compiletest: add support for unused extern notifications

As generated by --json unused-externs.
This commit is contained in:
Jeremy Fitzhardinge 2022-04-15 10:46:58 -07:00
parent ff18038d75
commit 0981b9857e

View File

@ -23,6 +23,14 @@ struct ArtifactNotification {
artifact: PathBuf,
}
#[derive(Deserialize)]
struct UnusedExternNotification {
#[allow(dead_code)]
lint_level: String,
#[allow(dead_code)]
unused_extern_names: Vec<String>,
}
#[derive(Deserialize, Clone)]
struct DiagnosticSpan {
file_name: String,
@ -113,6 +121,9 @@ pub fn extract_rendered(output: &str) -> String {
} else if serde_json::from_str::<ArtifactNotification>(line).is_ok() {
// Ignore the notification.
None
} else if serde_json::from_str::<UnusedExternNotification>(line).is_ok() {
// Ignore the notification.
None
} else {
print!(
"failed to decode compiler output as json: line: {}\noutput: {}",