Update error annotations in tests that successfully compile

Those annotation are silently ignored rather than begin validated
against compiler output. Update them before validation is enabled,
to avoid test failures.
This commit is contained in:
Tomasz Miąsko 2019-10-24 00:00:00 +00:00
parent b10f75ca64
commit dae4c6e722
16 changed files with 245 additions and 229 deletions

View File

@ -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
}

View File

@ -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]);
}

View File

@ -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
}

View File

@ -10,7 +10,7 @@ enum Void {}
#[derive(Debug)]
enum Foo {
Bar(u8),
Void(Void), //~ WARN never used
Void(Void), //~ WARN never constructed
}
fn main() {

View File

@ -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
@ -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
@ -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]

View File

@ -15,7 +15,6 @@ fn bar<'a>() {
return;
let _x = foo::<Vec<_>>(Vec::<&'a u32>::new());
//~^ ERROR the type `&'a u32` does not fulfill the required lifetime [E0477]
}
fn main() {}

View File

@ -28,6 +28,8 @@ impl fmt::Debug for CheaterDetectionMechanism {
fn main() {
let Social_exchange_psychology = CheaterDetectionMechanism {};
//~^ WARN should have a snake case name such as
//~^ WARN should have a snake case name
//~| NOTE #[warn(non_snake_case)]` implied by `#[warn(nonstandard_style)]
//~| NOTE people shouldn't have to change their usual style habits
//~| HELP convert the identifier to snake case
}

View File

@ -2,7 +2,7 @@
#![warn(overflowing_literals)]
fn main() {
let error = 255i8; //~WARNING literal out of range for i8
let error = 255i8; //~WARNING literal out of range for `i8`
let ok = 0b1000_0001; // should be ok -> i32
let ok = 0b0111_1111i8; // should be ok -> 127i8

View File

@ -1,7 +1,7 @@
// build-pass (FIXME(62277): could be check-pass?)
#![warn(unused_imports)]
use crate::foo::Bar; //~ WARNING first import
use crate::foo::Bar;
mod foo {
pub type Bar = i32;
@ -14,14 +14,14 @@ fn baz() -> Bar {
mod m1 { pub struct S {} }
mod m2 { pub struct S {} }
use m1::*;
use m2::*;
use m1::*; //~ WARNING unused import
use m2::*; //~ WARNING unused import
fn main() {
use crate::foo::Bar; //~ WARNING redundant import
use crate::foo::Bar; //~ WARNING imported redundantly
let _a: Bar = 3;
baz();
use m1::S; //~ WARNING redundant import
use m1::S;
let _s = S {};
}

View File

@ -1,8 +1,18 @@
// build-pass (FIXME(62277): could be check-pass?)
#[doc] //~ WARN attribute must be of the form
#[ignore()] //~ WARN attribute must be of the form
#[inline = ""] //~ WARN attribute must be of the form
#[link] //~ WARN attribute must be of the form
#[link = ""] //~ WARN attribute must be of the form
#[doc]
//~^ WARN attribute must be of the form
//~| WARN this was previously accepted
#[ignore()]
//~^ WARN attribute must be of the form
//~| WARN this was previously accepted
#[inline = ""]
//~^ WARN attribute must be of the form
//~| WARN this was previously accepted
#[link]
//~^WARN attribute must be of the form
//~| WARN this was previously accepted
#[link = ""]
//~^ WARN attribute must be of the form
//~| WARN this was previously accepted
fn main() {}

View File

@ -9,7 +9,7 @@ LL | #[doc]
= note: for more information, see issue #57571 <https://github.com/rust-lang/rust/issues/57571>
warning: attribute must be of the form `#[ignore]` or `#[ignore = "reason"]`
--> $DIR/malformed-regressions.rs:4:1
--> $DIR/malformed-regressions.rs:6:1
|
LL | #[ignore()]
| ^^^^^^^^^^^
@ -18,7 +18,7 @@ LL | #[ignore()]
= note: for more information, see issue #57571 <https://github.com/rust-lang/rust/issues/57571>
warning: attribute must be of the form `#[inline]` or `#[inline(always|never)]`
--> $DIR/malformed-regressions.rs:5:1
--> $DIR/malformed-regressions.rs:9:1
|
LL | #[inline = ""]
| ^^^^^^^^^^^^^^
@ -27,7 +27,7 @@ LL | #[inline = ""]
= note: for more information, see issue #57571 <https://github.com/rust-lang/rust/issues/57571>
warning: attribute must be of the form `#[link(name = "...", /*opt*/ kind = "dylib|static|...", /*opt*/ cfg = "...")]`
--> $DIR/malformed-regressions.rs:6:1
--> $DIR/malformed-regressions.rs:12:1
|
LL | #[link]
| ^^^^^^^
@ -36,7 +36,7 @@ LL | #[link]
= note: for more information, see issue #57571 <https://github.com/rust-lang/rust/issues/57571>
warning: attribute must be of the form `#[link(name = "...", /*opt*/ kind = "dylib|static|...", /*opt*/ cfg = "...")]`
--> $DIR/malformed-regressions.rs:7:1
--> $DIR/malformed-regressions.rs:15:1
|
LL | #[link = ""]
| ^^^^^^^^^^^^

View File

@ -32,14 +32,14 @@ fn main() {
match 10 {
1..10 => {},
8..=9 => {}, //~ WARNING multiple patterns covering the same range
8..=9 => {}, //~ WARNING unreachable pattern
_ => {},
}
match 10 {
5..7 => {},
6 => {}, //~ WARNING unreachable pattern
1..10 => {}, //~ WARNING multiple patterns covering the same range
1..10 => {},
9..=9 => {}, //~ WARNING unreachable pattern
6 => {}, //~ WARNING unreachable pattern
_ => {},

View File

@ -13,7 +13,7 @@ mod variant_struct_region {
x: &'a i32,
}
struct Bar<'a,'b> {
f: &'a Foo<'b> //~ ERROR reference has a longer lifetime
f: &'a Foo<'b>
}
}

View File

@ -13,7 +13,7 @@ mod rev_variant_struct_type {
x: fn(T)
}
struct Bar<'a,'b> {
f: &'a Foo<&'b i32> //~ ERROR reference has a longer lifetime
f: &'a Foo<&'b i32>
}
}

View File

@ -13,7 +13,7 @@ mod variant_struct_type {
x: T
}
struct Bar<'a,'b> {
f: &'a Foo<&'b i32> //~ ERROR reference has a longer lifetime
f: &'a Foo<&'b i32>
}
}