Skip to content

Commit b43a682

Browse files
committed
Auto merge of rust-lang#65759 - tmiasko:ui, r=petrochenkov
Validate error patterns and error annotation in ui tests when present Previously, when compilation succeeded, neither error patterns nor error annotation would be validated. Additionally, when compilation failed, only error patterns would be validated if both error patterns and error annotation were present. Now both error patterns and error annotation are validated when present, regardless of compilation status. Furthermore, for test that should run, the error patterns are matched against executable output, which is what some of tests already expect to happen, and when rust-lang#65506 is merged even more ui tests will. Fixes rust-lang#56277
2 parents 8b07292 + cfa2a26 commit b43a682

33 files changed

+283
-268
lines changed

src/test/ui-fulldeps/lint-group-plugin.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
// ignore-stage1
44

55
#![feature(plugin)]
6-
#![plugin(lint_group_plugin_test)]
6+
#![plugin(lint_group_plugin_test)] //~ WARNING use of deprecated attribute
77
#![allow(dead_code)]
88

99
fn lintme() { } //~ WARNING item is named 'lintme'

src/test/ui-fulldeps/lint-plugin.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// aux-build:lint-plugin-test.rs
33
// ignore-stage1
44
#![feature(plugin)]
5-
#![plugin(lint_plugin_test)]
5+
#![plugin(lint_plugin_test)] //~ WARNING use of deprecated attribute
66
#![allow(dead_code)]
77

88
fn lintme() { } //~ WARNING item is named 'lintme'

src/test/ui/conditional-compilation/cfg-attr-multi-true.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,5 @@ impl MustUseDeprecated { //~ warning: use of deprecated item
1717

1818
fn main() {
1919
MustUseDeprecated::new(); //~ warning: use of deprecated item
20-
//| warning: unused `MustUseDeprecated` that must be used
20+
//~| warning: unused `MustUseDeprecated` that must be used
2121
}

src/test/ui/const-generics/cannot-infer-type-for-const-param.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,5 @@
88
struct Foo<const NUM_BYTES: usize>(pub [u8; NUM_BYTES]);
99

1010
fn main() {
11-
let _ = Foo::<3>([1, 2, 3]); //~ ERROR type annotations needed
12-
//~^ ERROR mismatched types
11+
let _ = Foo::<3>([1, 2, 3]);
1312
}

src/test/ui/const-generics/issues/issue-62187-encountered-polymorphic-const.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,5 @@ impl<const L: usize> BitLen for [u8; L] {
1212
}
1313

1414
fn main() {
15-
let foo = <[u8; 2]>::BIT_LEN;
15+
let foo = <[u8; 2]>::BIT_LEN; //~ WARN unused variable
1616
}

src/test/ui/continue-after-missing-main.nll.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ error[E0601]: `main` function not found in crate `continue_after_missing_main`
33
|
44
LL | / #![allow(dead_code)]
55
LL | |
6-
LL | | // error-pattern:`main` function not found in crate
7-
LL | |
6+
LL | | struct Tableau<'a, MP> {
7+
LL | | provider: &'a MP,
88
... |
99
LL | |
1010
LL | | }

src/test/ui/continue-after-missing-main.rs

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
#![allow(dead_code)]
2-
3-
// error-pattern:`main` function not found in crate
1+
#![allow(dead_code)] //~ ERROR `main` function not found in crate
42

53
struct Tableau<'a, MP> {
64
provider: &'a MP,

src/test/ui/continue-after-missing-main.stderr

+3-3
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,15 @@ error[E0601]: `main` function not found in crate `continue_after_missing_main`
33
|
44
LL | / #![allow(dead_code)]
55
LL | |
6-
LL | | // error-pattern:`main` function not found in crate
7-
LL | |
6+
LL | | struct Tableau<'a, MP> {
7+
LL | | provider: &'a MP,
88
... |
99
LL | |
1010
LL | | }
1111
| |_^ consider adding a `main` function to `$DIR/continue-after-missing-main.rs`
1212

1313
error[E0623]: lifetime mismatch
14-
--> $DIR/continue-after-missing-main.rs:30:56
14+
--> $DIR/continue-after-missing-main.rs:28:56
1515
|
1616
LL | tableau: Tableau<'data_provider, AdaptedMatrixProvider<'original_data, MP>>,
1717
| ------------------------------------------------------------------ these two types are declared with different lifetimes...

src/test/ui/derive-uninhabited-enum-38885.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ enum Void {}
1010
#[derive(Debug)]
1111
enum Foo {
1212
Bar(u8),
13-
Void(Void), //~ WARN never used
13+
Void(Void), //~ WARN never constructed
1414
}
1515

1616
fn main() {

src/test/ui/feature-gate/issue-43106-gating-of-builtin-attrs.rs

+7-1
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
// Exception, a gated and deprecated attribute.
3939

4040
#![plugin_registrar] //~ WARN unused attribute
41+
//~| WARN use of deprecated attribute
4142

4243
// UNGATED WHITE-LISTED BUILT-IN ATTRIBUTES
4344

@@ -90,7 +91,7 @@
9091
#![crate_id = "10"] //~ WARN use of deprecated attribute
9192

9293
// FIXME(#44232) we should warn that this isn't used.
93-
#![feature(rust1)]
94+
#![feature(rust1)] //~ WARN no longer requires an attribute to enable
9495

9596
#![no_start] //~ WARN use of deprecated attribute
9697

@@ -215,20 +216,25 @@ mod macro_export {
215216

216217
#[plugin_registrar]
217218
//~^ WARN unused attribute
219+
//~| WARN use of deprecated attribute
218220
mod plugin_registrar {
219221
mod inner { #![plugin_registrar] }
220222
//~^ WARN unused attribute
223+
//~| WARN use of deprecated attribute
221224

222225
// for `fn f()` case, see gated-plugin_registrar.rs
223226

224227
#[plugin_registrar] struct S;
225228
//~^ WARN unused attribute
229+
//~| WARN use of deprecated attribute
226230

227231
#[plugin_registrar] type T = S;
228232
//~^ WARN unused attribute
233+
//~| WARN use of deprecated attribute
229234

230235
#[plugin_registrar] impl S { }
231236
//~^ WARN unused attribute
237+
//~| WARN use of deprecated attribute
232238
}
233239

234240
#[main]

0 commit comments

Comments
 (0)