From 6d07874e883ae4334b42ef3ab04cc3f52ee711ee Mon Sep 17 00:00:00 2001 From: Eric Huss Date: Tue, 24 Sep 2019 16:53:33 -0700 Subject: [PATCH] Don't emit explain with json short messages. --- src/libsyntax/json.rs | 7 +++++++ src/test/ui/json-short.stderr | 2 -- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/libsyntax/json.rs b/src/libsyntax/json.rs index 5cdea3aabbe11..2423e1070fc3e 100644 --- a/src/libsyntax/json.rs +++ b/src/libsyntax/json.rs @@ -112,6 +112,13 @@ impl Emitter for JsonEmitter { panic!("failed to print notification: {:?}", e); } } + + fn should_show_explain(&self) -> bool { + match self.json_rendered { + HumanReadableErrorType::Short(_) => false, + _ => true, + } + } } // The following data types are provided just for serialisation. diff --git a/src/test/ui/json-short.stderr b/src/test/ui/json-short.stderr index 0a1fb567714fb..d9f68023ce76d 100644 --- a/src/test/ui/json-short.stderr +++ b/src/test/ui/json-short.stderr @@ -15,5 +15,3 @@ started: https://doc.rust-lang.org/book/ "} {"message":"aborting due to previous error","code":null,"level":"error","spans":[],"children":[],"rendered":"error: aborting due to previous error "} -{"message":"For more information about this error, try `rustc --explain E0601`.","code":null,"level":"failure-note","spans":[],"children":[],"rendered":"For more information about this error, try `rustc --explain E0601`. -"}