Skip to content

Commit

Permalink
Rollup merge of rust-lang#65759 - tmiasko:ui, r=petrochenkov
Browse files Browse the repository at this point in the history
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
  • Loading branch information
tmandry committed Nov 1, 2019
2 parents 176bf24 + 2f188f8 commit a5efbe3
Show file tree
Hide file tree
Showing 27 changed files with 276 additions and 256 deletions.
2 changes: 1 addition & 1 deletion src/test/ui-fulldeps/lint-group-plugin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// ignore-stage1

#![feature(plugin)]
#![plugin(lint_group_plugin_test)]
#![plugin(lint_group_plugin_test)] //~ WARNING use of deprecated attribute
#![allow(dead_code)]

fn lintme() { } //~ WARNING item is named 'lintme'
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui-fulldeps/lint-plugin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// aux-build:lint-plugin-test.rs
// ignore-stage1
#![feature(plugin)]
#![plugin(lint_plugin_test)]
#![plugin(lint_plugin_test)] //~ WARNING use of deprecated attribute
#![allow(dead_code)]

fn lintme() { } //~ WARNING item is named 'lintme'
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/conditional-compilation/cfg-attr-multi-true.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@ impl MustUseDeprecated { //~ warning: use of deprecated item

fn main() {
MustUseDeprecated::new(); //~ warning: use of deprecated item
//| warning: unused `MustUseDeprecated` that must be used
//~| warning: unused `MustUseDeprecated` that must be used
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,5 @@
struct Foo<const NUM_BYTES: usize>(pub [u8; NUM_BYTES]);

fn main() {
let _ = Foo::<3>([1, 2, 3]); //~ ERROR type annotations needed
//~^ ERROR mismatched types
let _ = Foo::<3>([1, 2, 3]);
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@ impl<const L: usize> BitLen for [u8; L] {
}

fn main() {
let foo = <[u8; 2]>::BIT_LEN;
let foo = <[u8; 2]>::BIT_LEN; //~ WARN unused variable
}
4 changes: 1 addition & 3 deletions src/test/ui/continue-after-missing-main.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
#![allow(dead_code)]

// error-pattern:`main` function not found in crate
#![allow(dead_code)] //~ ERROR `main` function not found in crate

struct Tableau<'a, MP> {
provider: &'a MP,
Expand Down
6 changes: 3 additions & 3 deletions src/test/ui/continue-after-missing-main.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@ error[E0601]: `main` function not found in crate `continue_after_missing_main`
|
LL | / #![allow(dead_code)]
LL | |
LL | | // error-pattern:`main` function not found in crate
LL | |
LL | | struct Tableau<'a, MP> {
LL | | provider: &'a MP,
... |
LL | |
LL | | }
| |_^ consider adding a `main` function to `$DIR/continue-after-missing-main.rs`

error[E0623]: lifetime mismatch
--> $DIR/continue-after-missing-main.rs:30:56
--> $DIR/continue-after-missing-main.rs:28:56
|
LL | tableau: Tableau<'data_provider, AdaptedMatrixProvider<'original_data, MP>>,
| ------------------------------------------------------------------ these two types are declared with different lifetimes...
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/derive-uninhabited-enum-38885.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ enum Void {}
#[derive(Debug)]
enum Foo {
Bar(u8),
Void(Void), //~ WARN never used
Void(Void), //~ WARN never constructed
}

fn main() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
// Exception, a gated and deprecated attribute.

#![plugin_registrar] //~ WARN unused attribute
//~| WARN use of deprecated attribute

// UNGATED WHITE-LISTED BUILT-IN ATTRIBUTES

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

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

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

Expand Down Expand Up @@ -215,20 +216,25 @@ mod macro_export {

#[plugin_registrar]
//~^ WARN unused attribute
//~| WARN use of deprecated attribute
mod plugin_registrar {
mod inner { #![plugin_registrar] }
//~^ WARN unused attribute
//~| WARN use of deprecated attribute

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

#[plugin_registrar] struct S;
//~^ WARN unused attribute
//~| WARN use of deprecated attribute

#[plugin_registrar] type T = S;
//~^ WARN unused attribute
//~| WARN use of deprecated attribute

#[plugin_registrar] impl S { }
//~^ WARN unused attribute
//~| WARN use of deprecated attribute
}

#[main]
Expand Down
Loading

0 comments on commit a5efbe3

Please sign in to comment.