mirror of
https://github.com/rust-lang/rust.git
synced 2026-05-29 20:46:07 +03:00
Print tip for human error format when check fail
This commit is contained in:
@@ -878,6 +878,21 @@ fn check_expected_errors(&self, proc_res: &ProcRes) {
|
||||
prefix = self.error_prefix(),
|
||||
n = not_found.len(),
|
||||
);
|
||||
|
||||
// FIXME: Ideally, we should check this at the place where we actually parse error annotations.
|
||||
// it's better to use (negated) heuristic inside normalize_output if possible
|
||||
if let Some(human_format) = self.props.compile_flags.iter().find(|flag| {
|
||||
// `human`, `human-unicode`, `short` will not generate JSON output
|
||||
flag.contains("error-format")
|
||||
&& (flag.contains("short") || flag.contains("human"))
|
||||
}) {
|
||||
let msg = format!(
|
||||
"tests with compile flag `{}` should not have error annotations such as `//~ ERROR`",
|
||||
human_format
|
||||
).color(Color::Red);
|
||||
writeln!(self.stdout, "{}", msg);
|
||||
}
|
||||
|
||||
for error in ¬_found {
|
||||
print_error(error);
|
||||
let mut suggestions = Vec::new();
|
||||
|
||||
Reference in New Issue
Block a user