Rollup merge of #64753 - ehuss:json-short-explain, r=Mark-Simulacrum
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.
This commit is contained in:
commit
fa6dfc995e
2 changed files with 7 additions and 2 deletions
|
@ -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.
|
||||
|
|
|
@ -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`.
|
||||
"}
|
||||
|
|
Loading…
Reference in a new issue