Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Validate error patterns and error annotation in ui tests when present #65759

Merged
merged 8 commits into from
Nov 3, 2019
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: 2 additions & 2 deletions src/test/ui/continue-after-missing-main.nll.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ 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 | | }
Expand Down
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