Skip to content

Commit

Permalink
Make error and warning annotations mandatory in UI tests
Browse files Browse the repository at this point in the history
This change makes error and warning annotations mandatory in UI tests.
The only exception are tests that use error patterns to match compiler
output and don't have any annotations.
  • Loading branch information
tmiasko committed Nov 10, 2019
1 parent 70b146c commit 427952e
Show file tree
Hide file tree
Showing 75 changed files with 380 additions and 326 deletions.
2 changes: 1 addition & 1 deletion src/test/ui/associated-type-bounds/dyn-lcsit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

#![feature(associated_type_bounds)]
#![feature(impl_trait_in_bindings)]

//~^ WARNING `impl_trait_in_bindings` is incomplete
#![allow(non_upper_case_globals)]

use std::ops::Add;
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/associated-type-bounds/lcsit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

#![feature(associated_type_bounds)]
#![feature(impl_trait_in_bindings)]

//~^ WARNING `impl_trait_in_bindings` is incomplete
#![allow(non_upper_case_globals)]

use std::ops::Add;
Expand Down
26 changes: 13 additions & 13 deletions src/test/ui/associated-type-bounds/type-alias.rs
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
// build-pass (FIXME(62277): could be check-pass?)
// check-pass

#![feature(associated_type_bounds)]

type _TaWhere1<T> where T: Iterator<Item: Copy> = T;
type _TaWhere2<T> where T: Iterator<Item: 'static> = T;
type _TaWhere3<T> where T: Iterator<Item: 'static> = T;
type _TaWhere4<T> where T: Iterator<Item: 'static + Copy + Send> = T;
type _TaWhere5<T> where T: Iterator<Item: for<'a> Into<&'a u8>> = T;
type _TaWhere6<T> where T: Iterator<Item: Iterator<Item: Copy>> = T;
type _TaWhere1<T> where T: Iterator<Item: Copy> = T; //~ WARNING type_alias_bounds
type _TaWhere2<T> where T: Iterator<Item: 'static> = T; //~ WARNING type_alias_bounds
type _TaWhere3<T> where T: Iterator<Item: 'static> = T; //~ WARNING type_alias_bounds
type _TaWhere4<T> where T: Iterator<Item: 'static + Copy + Send> = T; //~ WARNING type_alias_bounds
type _TaWhere5<T> where T: Iterator<Item: for<'a> Into<&'a u8>> = T; //~ WARNING type_alias_bounds
type _TaWhere6<T> where T: Iterator<Item: Iterator<Item: Copy>> = T; //~ WARNING type_alias_bounds

type _TaInline1<T: Iterator<Item: Copy>> = T;
type _TaInline2<T: Iterator<Item: 'static>> = T;
type _TaInline3<T: Iterator<Item: 'static>> = T;
type _TaInline4<T: Iterator<Item: 'static + Copy + Send>> = T;
type _TaInline5<T: Iterator<Item: for<'a> Into<&'a u8>>> = T;
type _TaInline6<T: Iterator<Item: Iterator<Item: Copy>>> = T;
type _TaInline1<T: Iterator<Item: Copy>> = T; //~ WARNING type_alias_bounds
type _TaInline2<T: Iterator<Item: 'static>> = T; //~ WARNING type_alias_bounds
type _TaInline3<T: Iterator<Item: 'static>> = T; //~ WARNING type_alias_bounds
type _TaInline4<T: Iterator<Item: 'static + Copy + Send>> = T; //~ WARNING type_alias_bounds
type _TaInline5<T: Iterator<Item: for<'a> Into<&'a u8>>> = T; //~ WARNING type_alias_bounds
type _TaInline6<T: Iterator<Item: Iterator<Item: Copy>>> = T; //~ WARNING type_alias_bounds

fn main() {}
1 change: 1 addition & 0 deletions src/test/ui/async-await/issues/issue-54752-async-block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@
// pp-exact

fn main() { let _a = (async { }); }
//~^ WARNING unnecessary parentheses around assigned value
1 change: 1 addition & 0 deletions src/test/ui/block-expr-precedence.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,4 +58,5 @@ pub fn main() {
if (true) { 12; } {-num};
if (true) { 12; }; {-num};
if (true) { 12; };;; -num;
//~^ WARNING unnecessary trailing semicolons
}
2 changes: 1 addition & 1 deletion src/test/ui/codemap_tests/unicode_3.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// build-pass (FIXME(62277): could be check-pass?)

fn main() {
let s = "ZͨA͑ͦ͒͋ͤ͑̚L̄͑͋Ĝͨͥ̿͒̽̈́Oͥ͛ͭ!̏"; while true { break; }
let s = "ZͨA͑ͦ͒͋ͤ͑̚L̄͑͋Ĝͨͥ̿͒̽̈́Oͥ͛ͭ!̏"; while true { break; } //~ WARNING while_true
println!("{}", s);
}
8 changes: 4 additions & 4 deletions src/test/ui/consts/const-eval/const_fn_ptr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,18 @@ fn double(x: usize) -> usize { x * 2 }
const fn double_const(x: usize) -> usize { x * 2 }

const X: fn(usize) -> usize = double;
const X_const: fn(usize) -> usize = double_const;
const X_CONST: fn(usize) -> usize = double_const;

const fn bar(x: usize) -> usize {
X(x)
X(x) //~ WARNING skipping const checks
}

const fn bar_const(x: usize) -> usize {
X_const(x)
X_CONST(x) //~ WARNING skipping const checks
}

const fn foo(x: fn(usize) -> usize, y: usize) -> usize {
x(y)
x(y) //~ WARNING skipping const checks
}

fn main() {
Expand Down
10 changes: 1 addition & 9 deletions src/test/ui/consts/const-eval/const_fn_ptr.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ LL | X(x)
warning: skipping const checks
--> $DIR/const_fn_ptr.rs:16:5
|
LL | X_const(x)
LL | X_CONST(x)
| ^^^^^^^^^^

warning: skipping const checks
Expand All @@ -16,11 +16,3 @@ warning: skipping const checks
LL | x(y)
| ^^^^

warning: constant `X_const` should have an upper case name
--> $DIR/const_fn_ptr.rs:9:7
|
LL | const X_const: fn(usize) -> usize = double_const;
| ^^^^^^^ help: convert the identifier to upper case: `X_CONST`
|
= note: `#[warn(non_upper_case_globals)]` on by default

2 changes: 1 addition & 1 deletion src/test/ui/consts/const-eval/issue-64970.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ fn foo(mut n: i32) {
}

if n > 0i32 {
1i32 / n;
let _ = 1i32 / n;
}
}
8 changes: 0 additions & 8 deletions src/test/ui/consts/const-eval/issue-64970.stderr

This file was deleted.

6 changes: 4 additions & 2 deletions src/test/ui/consts/miri_unleashed/enum_discriminants.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ const OVERFLOW: usize = {
C(WithWraparoundInvalidValues),
}

let x = Foo::B;
let x = Foo::B; //~ WARNING skipping const checks
match x {
Foo::B => 0,
Foo::B => 0, //~ WARNING skipping const checks
_ => panic!(),
}
};
Expand Down Expand Up @@ -86,6 +86,8 @@ const MORE_OVERFLOW: usize = {
}

if let E1::V2 { .. } = (E1::V1 { f: true }) {
//~^ WARNING skipping const checks
//~| WARNING skipping const checks
unreachable!()
}
if let E1::V1 { .. } = (E1::V1 { f: true }) {
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/consts/packed_pattern.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const FOO: Foo = Foo {
fn main() {
match FOO {
Foo { field: (5, 6, 7, 8) } => {},
FOO => unreachable!(),
FOO => unreachable!(), //~ WARNING unreachable pattern
_ => unreachable!(),
}
}
2 changes: 1 addition & 1 deletion src/test/ui/consts/packed_pattern2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const FOO: Bar = Bar {
fn main() {
match FOO {
Bar { a: Foo { field: (5, 6) } } => {},
FOO => unreachable!(),
FOO => unreachable!(), //~ WARNING unreachable pattern
_ => unreachable!(),
}
}
1 change: 1 addition & 0 deletions src/test/ui/deprecation/deprecation-in-future.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ pub fn deprecated_future() {}

fn test() {
deprecated_future(); // ok; deprecated_in_future only applies to rustc_deprecated
//~^ WARNING use of deprecated item 'deprecated_future': text [deprecated]
}

fn main() {}
2 changes: 1 addition & 1 deletion src/test/ui/extern/extern-prelude-core.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// run-pass
#![feature(extern_prelude, lang_items, start)]
#![feature(lang_items, start)]
#![no_std]

extern crate std as other;
Expand Down
8 changes: 0 additions & 8 deletions src/test/ui/extern/extern-prelude-core.stderr

This file was deleted.

1 change: 0 additions & 1 deletion src/test/ui/extern/extern-prelude-std.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
// run-pass
#![feature(extern_prelude)]

mod foo {
pub fn test() {
Expand Down
8 changes: 0 additions & 8 deletions src/test/ui/extern/extern-prelude-std.stderr

This file was deleted.

2 changes: 1 addition & 1 deletion src/test/ui/hygiene/dollar-crate-modern.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// check-pass
// aux-build:intercrate.rs

#![feature(decl_macro, crate_in_paths)]
#![feature(decl_macro)]

extern crate intercrate;

Expand Down
8 changes: 0 additions & 8 deletions src/test/ui/hygiene/dollar-crate-modern.stderr

This file was deleted.

1 change: 1 addition & 0 deletions src/test/ui/hygiene/generic_params.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
// ignore-pretty pretty-printing is unhygienic

#![feature(decl_macro, rustc_attrs, const_generics)]
//~^ WARNING the feature `const_generics` is incomplete

mod type_params {
macro m($T:ident) {
Expand Down
28 changes: 28 additions & 0 deletions src/test/ui/hygiene/hygienic-labels-in-let.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,36 @@ macro_rules! loop_x {
($e: expr) => {
// $e shouldn't be able to interact with this 'x
'x: loop { $e }
//~^ WARNING shadows a label name that is already in scope
//~| WARNING shadows a label name that is already in scope
//~| WARNING shadows a label name that is already in scope
//~| WARNING shadows a label name that is already in scope
}
}

macro_rules! while_true {
($e: expr) => {
// $e shouldn't be able to interact with this 'x
'x: while 1 + 1 == 2 { $e }
//~^ WARNING shadows a label name that is already in scope
//~| WARNING shadows a label name that is already in scope
//~| WARNING shadows a label name that is already in scope
//~| WARNING shadows a label name that is already in scope
//~| WARNING shadows a label name that is already in scope
}
}

macro_rules! run_once {
($e: expr) => {
// ditto
'x: for _ in 0..1 { $e }
//~^ WARNING shadows a label name that is already in scope
//~| WARNING shadows a label name that is already in scope
//~| WARNING shadows a label name that is already in scope
//~| WARNING shadows a label name that is already in scope
//~| WARNING shadows a label name that is already in scope
//~| WARNING shadows a label name that is already in scope
//~| WARNING shadows a label name that is already in scope
}
}

Expand All @@ -45,6 +61,8 @@ pub fn main() {

let k: isize = {
'x: for _ in 0..1 {
//~^ WARNING shadows a label name that is already in scope
//~| WARNING shadows a label name that is already in scope
// ditto
loop_x!(break 'x);
i += 1;
Expand All @@ -55,6 +73,10 @@ pub fn main() {

let l: isize = {
'x: for _ in 0..1 {
//~^ WARNING shadows a label name that is already in scope
//~| WARNING shadows a label name that is already in scope
//~| WARNING shadows a label name that is already in scope
//~| WARNING shadows a label name that is already in scope
// ditto
while_true!(break 'x);
i += 1;
Expand All @@ -65,6 +87,12 @@ pub fn main() {

let n: isize = {
'x: for _ in 0..1 {
//~^ WARNING shadows a label name that is already in scope
//~| WARNING shadows a label name that is already in scope
//~| WARNING shadows a label name that is already in scope
//~| WARNING shadows a label name that is already in scope
//~| WARNING shadows a label name that is already in scope
//~| WARNING shadows a label name that is already in scope
// ditto
run_once!(continue 'x);
i += 1;
Expand Down
Loading

0 comments on commit 427952e

Please sign in to comment.