Rollup merge of #119184 - Rajveer100:branch-for-issue-118752, r=davidtwco
Switch from using `//~ERROR` annotations with `--error-format` to `error-pattern` Fixes #118752 As noticed by ```@jyn514``` while working on a patch, tests failed due to `//~ERROR` annotations used in combination with the older `--error-format` which is now `error-pattern`.
This commit is contained in:
commit
9fa0c8e1c7
22 changed files with 1006 additions and 993 deletions
|
|
@ -11,7 +11,7 @@ use once_cell::sync::Lazy;
|
|||
use regex::Regex;
|
||||
use tracing::*;
|
||||
|
||||
#[derive(Clone, Debug, PartialEq)]
|
||||
#[derive(Copy, Clone, Debug, PartialEq)]
|
||||
pub enum ErrorKind {
|
||||
Help,
|
||||
Error,
|
||||
|
|
|
|||
|
|
@ -3977,23 +3977,29 @@ impl<'test> TestCx<'test> {
|
|||
proc_res.status,
|
||||
self.props.error_patterns
|
||||
);
|
||||
|
||||
let check_patterns = should_run == WillExecute::No
|
||||
&& (!self.props.error_patterns.is_empty()
|
||||
|| !self.props.regex_error_patterns.is_empty());
|
||||
if !explicit && self.config.compare_mode.is_none() {
|
||||
let check_patterns = should_run == WillExecute::No
|
||||
&& (!self.props.error_patterns.is_empty()
|
||||
|| !self.props.regex_error_patterns.is_empty());
|
||||
|
||||
let check_annotations = !check_patterns || !expected_errors.is_empty();
|
||||
|
||||
if check_patterns {
|
||||
// "// error-pattern" comments
|
||||
let output_to_check = self.get_output(&proc_res);
|
||||
self.check_all_error_patterns(&output_to_check, &proc_res, pm);
|
||||
}
|
||||
|
||||
if check_annotations {
|
||||
// "//~ERROR comments"
|
||||
self.check_expected_errors(expected_errors, &proc_res);
|
||||
}
|
||||
} else if explicit && !expected_errors.is_empty() {
|
||||
let msg = format!(
|
||||
"line {}: cannot combine `--error-format` with {} annotations; use `error-pattern` instead",
|
||||
expected_errors[0].line_num,
|
||||
expected_errors[0].kind.unwrap_or(ErrorKind::Error),
|
||||
);
|
||||
self.fatal(&msg);
|
||||
}
|
||||
if check_patterns {
|
||||
// "// error-pattern" comments
|
||||
let output_to_check = self.get_output(&proc_res);
|
||||
self.check_all_error_patterns(&output_to_check, &proc_res, pm);
|
||||
}
|
||||
|
||||
if self.props.run_rustfix && self.config.compare_mode.is_none() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue