Skip to content

Commit

Permalink
Rollup merge of #64753 - ehuss:json-short-explain, r=Mark-Simulacrum
Browse files Browse the repository at this point in the history
Don't emit explain with json short messages.

This fixes an issue where `--error-format=json --json=diagnostic-short` would emit the "For more information about this error" message, which doesn't match the behavior of `--error-format=short` which explicitly excludes it.
  • Loading branch information
Centril committed Sep 25, 2019
2 parents 5ed746b + 6d07874 commit fa6dfc9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
7 changes: 7 additions & 0 deletions src/libsyntax/json.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 0 additions & 2 deletions src/test/ui/json-short.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -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`.
"}

0 comments on commit fa6dfc9

Please sign in to comment.