Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit d8c54d4

Browse files
committedApr 2, 2025·
Auto merge of rust-lang#139137 - petrochenkov:errwhere2, r=jieyouxu
compiletest: Require `//~` annotations even if `error-pattern` is specified This is continuation of rust-lang#138865 with some help from rust-lang#139100. `error-pattern` annotations that duplicate the newly added `//~` annotations are removed, other `error-pattern`s are not touched yet. In exceptional cases `//@ compile-flags: --error-format=human` can be used to opt out of these checks. In this PR I only had to use the opt out 3 times: - `tests/ui/parser/utf16-{be,le}-without-bom.rs` - there are too many errors that are nearly identical (modulo location), because an error is reported on every second symbol - `tests/ui-fulldeps/missing-rustc-driver-error.rs` - the errors list various rustc crate dependencies and may unexpectedly invalidate on random rustc changes
2 parents 4f0de4c + 5ca4dfc commit d8c54d4

File tree

315 files changed

+673
-530
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

315 files changed

+673
-530
lines changed
 

‎src/doc/rustc-dev-guide/src/tests/ui.md

Lines changed: 3 additions & 0 deletions

‎src/tools/compiletest/src/runtest/ui.rs

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -169,16 +169,9 @@ impl TestCx<'_> {
169169
self.props.error_patterns
170170
);
171171

172-
let check_patterns = should_run == WillExecute::No
173-
&& (!self.props.error_patterns.is_empty()
174-
|| !self.props.regex_error_patterns.is_empty());
175172
if !explicit && self.config.compare_mode.is_none() {
176-
let check_annotations = !check_patterns || !expected_errors.is_empty();
177-
178-
if check_annotations {
179-
// "//~ERROR comments"
180-
self.check_expected_errors(expected_errors, &proc_res);
181-
}
173+
// "//~ERROR comments"
174+
self.check_expected_errors(expected_errors, &proc_res);
182175
} else if explicit && !expected_errors.is_empty() {
183176
let msg = format!(
184177
"line {}: cannot combine `--error-format` with {} annotations; use `error-pattern` instead",
@@ -188,7 +181,10 @@ impl TestCx<'_> {
188181
self.fatal(&msg);
189182
}
190183
let output_to_check = self.get_output(&proc_res);
191-
if check_patterns {
184+
if should_run == WillExecute::No
185+
&& (!self.props.error_patterns.is_empty()
186+
|| !self.props.regex_error_patterns.is_empty())
187+
{
192188
// "// error-pattern" comments
193189
self.check_all_error_patterns(&output_to_check, &proc_res, pm);
194190
}

0 commit comments

Comments
 (0)
This repository has been archived.