Skip to content

Commit ecba3f8

Browse files
committed
compiletest: Require //~ annotations even if error-pattern is specified
1 parent 79de6c0 commit ecba3f8

File tree

315 files changed

+656
-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

+656
-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
}
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// test the behavior of the --no-run flag without the --test flag
22

33
//@ compile-flags:-Z unstable-options --no-run --test-args=--test-threads=1
4-
//@ error-pattern: the `--test` flag must be passed
54

65
pub fn f() {}
6+
7+
//~? ERROR the `--test` flag must be passed to enable `--no-run`
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
//@ compile-flags:--theme {{src-base}}/invalid-theme-name.rs
2-
//@ error-pattern: invalid argument
32
//@ error-pattern: must have a .css extension
3+
4+
//~? ERROR invalid argument: "$DIR/invalid-theme-name.rs"
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
//@ check-pass
22
//@ compile-flags: --passes list
3-
//@ error-pattern: the `passes` flag no longer functions
3+
4+
//~? WARN the `passes` flag no longer functions
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
//@ error-pattern: no documentation found
21
//@ normalize-stderr: "nightly|beta|1\.[0-9][0-9]\.[0-9]" -> "$$CHANNEL"
32
#![deny(rustdoc::missing_crate_level_docs)]
43
//^~ NOTE defined here
54

65
pub fn foo() {}
6+
7+
//~? ERROR no documentation found for this crate's top-level module

tests/rustdoc-ui/lints/no-crate-level-doc-lint.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ error: no documentation found for this crate's top-level module
33
= help: The following guide may be of use:
44
https://doc.rust-lang.org/$CHANNEL/rustdoc/how-to-write-documentation.html
55
note: the lint level is defined here
6-
--> $DIR/no-crate-level-doc-lint.rs:3:9
6+
--> $DIR/no-crate-level-doc-lint.rs:2:9
77
|
88
LL | #![deny(rustdoc::missing_crate_level_docs)]
99
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

tests/rustdoc-ui/track-diagnostics.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@
88
struct A;
99
struct B;
1010

11-
pub const S: A = B;
11+
pub const S: A = B; //~ ERROR mismatched types

tests/ui-fulldeps/missing-rustc-driver-error.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// Test that we get the following hint when trying to use a compiler crate without rustc_driver.
22
//@ error-pattern: try adding `extern crate rustc_driver;` at the top level of this crate
3-
//@ compile-flags: --emit link
3+
//@ compile-flags: --emit link --error-format=human
44
//@ normalize-stderr: ".*crate .* required.*\n\n" -> ""
55
//@ normalize-stderr: "aborting due to [0-9]+" -> "aborting due to NUMBER"
66

tests/ui/abi/fixed_x18.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,5 @@
2323

2424
#[lang = "sized"]
2525
trait Sized {}
26+
27+
//~? ERROR the `-Zfixed-x18` flag is not supported on the `

0 commit comments

Comments
 (0)