about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorJeremy Fitzhardinge <jsgf@fb.com>2022-04-15 10:46:58 -0700
committerJeremy Fitzhardinge <jsgf@fb.com>2022-04-27 09:37:45 -0700
commit0981b9857ed9a4c840221b089fc5103373c8595f (patch)
tree0337e711d6830d854e44d6d8a13911d41e637415 /src
parentff18038d750d5b692b4896c338e33ed134fe4ba2 (diff)
compiletest: add support for unused extern notifications
As generated by --json unused-externs.
Diffstat (limited to 'src')
-rw-r--r--src/tools/compiletest/src/json.rs11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/tools/compiletest/src/json.rs b/src/tools/compiletest/src/json.rs
index a5ff779a4ab..10726b98420 100644
--- a/src/tools/compiletest/src/json.rs
+++ b/src/tools/compiletest/src/json.rs
@@ -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: {}",