Skip to content

Commit 427952e

Browse files
committed
Make error and warning annotations mandatory in UI tests
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.
1 parent 70b146c commit 427952e

File tree

75 files changed

+380
-326
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

75 files changed

+380
-326
lines changed

src/test/ui/associated-type-bounds/dyn-lcsit.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
#![feature(associated_type_bounds)]
44
#![feature(impl_trait_in_bindings)]
5-
5+
//~^ WARNING `impl_trait_in_bindings` is incomplete
66
#![allow(non_upper_case_globals)]
77

88
use std::ops::Add;

src/test/ui/associated-type-bounds/lcsit.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
#![feature(associated_type_bounds)]
44
#![feature(impl_trait_in_bindings)]
5-
5+
//~^ WARNING `impl_trait_in_bindings` is incomplete
66
#![allow(non_upper_case_globals)]
77

88
use std::ops::Add;
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
1-
// build-pass (FIXME(62277): could be check-pass?)
1+
// check-pass
22

33
#![feature(associated_type_bounds)]
44

5-
type _TaWhere1<T> where T: Iterator<Item: Copy> = T;
6-
type _TaWhere2<T> where T: Iterator<Item: 'static> = T;
7-
type _TaWhere3<T> where T: Iterator<Item: 'static> = T;
8-
type _TaWhere4<T> where T: Iterator<Item: 'static + Copy + Send> = T;
9-
type _TaWhere5<T> where T: Iterator<Item: for<'a> Into<&'a u8>> = T;
10-
type _TaWhere6<T> where T: Iterator<Item: Iterator<Item: Copy>> = T;
5+
type _TaWhere1<T> where T: Iterator<Item: Copy> = T; //~ WARNING type_alias_bounds
6+
type _TaWhere2<T> where T: Iterator<Item: 'static> = T; //~ WARNING type_alias_bounds
7+
type _TaWhere3<T> where T: Iterator<Item: 'static> = T; //~ WARNING type_alias_bounds
8+
type _TaWhere4<T> where T: Iterator<Item: 'static + Copy + Send> = T; //~ WARNING type_alias_bounds
9+
type _TaWhere5<T> where T: Iterator<Item: for<'a> Into<&'a u8>> = T; //~ WARNING type_alias_bounds
10+
type _TaWhere6<T> where T: Iterator<Item: Iterator<Item: Copy>> = T; //~ WARNING type_alias_bounds
1111

12-
type _TaInline1<T: Iterator<Item: Copy>> = T;
13-
type _TaInline2<T: Iterator<Item: 'static>> = T;
14-
type _TaInline3<T: Iterator<Item: 'static>> = T;
15-
type _TaInline4<T: Iterator<Item: 'static + Copy + Send>> = T;
16-
type _TaInline5<T: Iterator<Item: for<'a> Into<&'a u8>>> = T;
17-
type _TaInline6<T: Iterator<Item: Iterator<Item: Copy>>> = T;
12+
type _TaInline1<T: Iterator<Item: Copy>> = T; //~ WARNING type_alias_bounds
13+
type _TaInline2<T: Iterator<Item: 'static>> = T; //~ WARNING type_alias_bounds
14+
type _TaInline3<T: Iterator<Item: 'static>> = T; //~ WARNING type_alias_bounds
15+
type _TaInline4<T: Iterator<Item: 'static + Copy + Send>> = T; //~ WARNING type_alias_bounds
16+
type _TaInline5<T: Iterator<Item: for<'a> Into<&'a u8>>> = T; //~ WARNING type_alias_bounds
17+
type _TaInline6<T: Iterator<Item: Iterator<Item: Copy>>> = T; //~ WARNING type_alias_bounds
1818

1919
fn main() {}

src/test/ui/async-await/issues/issue-54752-async-block.rs

+1
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@
44
// pp-exact
55

66
fn main() { let _a = (async { }); }
7+
//~^ WARNING unnecessary parentheses around assigned value

src/test/ui/block-expr-precedence.rs

+1
Original file line numberDiff line numberDiff line change
@@ -58,4 +58,5 @@ pub fn main() {
5858
if (true) { 12; } {-num};
5959
if (true) { 12; }; {-num};
6060
if (true) { 12; };;; -num;
61+
//~^ WARNING unnecessary trailing semicolons
6162
}
+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// build-pass (FIXME(62277): could be check-pass?)
22

33
fn main() {
4-
let s = "ZͨA͑ͦ͒͋ͤ͑̚L̄͑͋Ĝͨͥ̿͒̽̈́Oͥ͛ͭ!̏"; while true { break; }
4+
let s = "ZͨA͑ͦ͒͋ͤ͑̚L̄͑͋Ĝͨͥ̿͒̽̈́Oͥ͛ͭ!̏"; while true { break; } //~ WARNING while_true
55
println!("{}", s);
66
}

src/test/ui/consts/const-eval/const_fn_ptr.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,18 @@ fn double(x: usize) -> usize { x * 2 }
66
const fn double_const(x: usize) -> usize { x * 2 }
77

88
const X: fn(usize) -> usize = double;
9-
const X_const: fn(usize) -> usize = double_const;
9+
const X_CONST: fn(usize) -> usize = double_const;
1010

1111
const fn bar(x: usize) -> usize {
12-
X(x)
12+
X(x) //~ WARNING skipping const checks
1313
}
1414

1515
const fn bar_const(x: usize) -> usize {
16-
X_const(x)
16+
X_CONST(x) //~ WARNING skipping const checks
1717
}
1818

1919
const fn foo(x: fn(usize) -> usize, y: usize) -> usize {
20-
x(y)
20+
x(y) //~ WARNING skipping const checks
2121
}
2222

2323
fn main() {

src/test/ui/consts/const-eval/const_fn_ptr.stderr

+1-9
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ LL | X(x)
77
warning: skipping const checks
88
--> $DIR/const_fn_ptr.rs:16:5
99
|
10-
LL | X_const(x)
10+
LL | X_CONST(x)
1111
| ^^^^^^^^^^
1212

1313
warning: skipping const checks
@@ -16,11 +16,3 @@ warning: skipping const checks
1616
LL | x(y)
1717
| ^^^^
1818

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

src/test/ui/consts/const-eval/issue-64970.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,6 @@ fn foo(mut n: i32) {
1010
}
1111

1212
if n > 0i32 {
13-
1i32 / n;
13+
let _ = 1i32 / n;
1414
}
1515
}

src/test/ui/consts/const-eval/issue-64970.stderr

-8
This file was deleted.

src/test/ui/consts/miri_unleashed/enum_discriminants.rs

+4-2
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@ const OVERFLOW: usize = {
2020
C(WithWraparoundInvalidValues),
2121
}
2222

23-
let x = Foo::B;
23+
let x = Foo::B; //~ WARNING skipping const checks
2424
match x {
25-
Foo::B => 0,
25+
Foo::B => 0, //~ WARNING skipping const checks
2626
_ => panic!(),
2727
}
2828
};
@@ -86,6 +86,8 @@ const MORE_OVERFLOW: usize = {
8686
}
8787

8888
if let E1::V2 { .. } = (E1::V1 { f: true }) {
89+
//~^ WARNING skipping const checks
90+
//~| WARNING skipping const checks
8991
unreachable!()
9092
}
9193
if let E1::V1 { .. } = (E1::V1 { f: true }) {

src/test/ui/consts/packed_pattern.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ const FOO: Foo = Foo {
1313
fn main() {
1414
match FOO {
1515
Foo { field: (5, 6, 7, 8) } => {},
16-
FOO => unreachable!(),
16+
FOO => unreachable!(), //~ WARNING unreachable pattern
1717
_ => unreachable!(),
1818
}
1919
}

src/test/ui/consts/packed_pattern2.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ const FOO: Bar = Bar {
2121
fn main() {
2222
match FOO {
2323
Bar { a: Foo { field: (5, 6) } } => {},
24-
FOO => unreachable!(),
24+
FOO => unreachable!(), //~ WARNING unreachable pattern
2525
_ => unreachable!(),
2626
}
2727
}

src/test/ui/deprecation/deprecation-in-future.rs

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ pub fn deprecated_future() {}
77

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

1213
fn main() {}

src/test/ui/extern/extern-prelude-core.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// run-pass
2-
#![feature(extern_prelude, lang_items, start)]
2+
#![feature(lang_items, start)]
33
#![no_std]
44

55
extern crate std as other;

src/test/ui/extern/extern-prelude-core.stderr

-8
This file was deleted.

src/test/ui/extern/extern-prelude-std.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
// run-pass
2-
#![feature(extern_prelude)]
32

43
mod foo {
54
pub fn test() {

src/test/ui/extern/extern-prelude-std.stderr

-8
This file was deleted.

src/test/ui/hygiene/dollar-crate-modern.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
// check-pass
44
// aux-build:intercrate.rs
55

6-
#![feature(decl_macro, crate_in_paths)]
6+
#![feature(decl_macro)]
77

88
extern crate intercrate;
99

src/test/ui/hygiene/dollar-crate-modern.stderr

-8
This file was deleted.

src/test/ui/hygiene/generic_params.rs

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
// ignore-pretty pretty-printing is unhygienic
55

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

89
mod type_params {
910
macro m($T:ident) {

src/test/ui/hygiene/hygienic-labels-in-let.rs

+28
Original file line numberDiff line numberDiff line change
@@ -13,20 +13,36 @@ macro_rules! loop_x {
1313
($e: expr) => {
1414
// $e shouldn't be able to interact with this 'x
1515
'x: loop { $e }
16+
//~^ WARNING shadows a label name that is already in scope
17+
//~| WARNING shadows a label name that is already in scope
18+
//~| WARNING shadows a label name that is already in scope
19+
//~| WARNING shadows a label name that is already in scope
1620
}
1721
}
1822

1923
macro_rules! while_true {
2024
($e: expr) => {
2125
// $e shouldn't be able to interact with this 'x
2226
'x: while 1 + 1 == 2 { $e }
27+
//~^ WARNING shadows a label name that is already in scope
28+
//~| WARNING shadows a label name that is already in scope
29+
//~| WARNING shadows a label name that is already in scope
30+
//~| WARNING shadows a label name that is already in scope
31+
//~| WARNING shadows a label name that is already in scope
2332
}
2433
}
2534

2635
macro_rules! run_once {
2736
($e: expr) => {
2837
// ditto
2938
'x: for _ in 0..1 { $e }
39+
//~^ WARNING shadows a label name that is already in scope
40+
//~| WARNING shadows a label name that is already in scope
41+
//~| WARNING shadows a label name that is already in scope
42+
//~| WARNING shadows a label name that is already in scope
43+
//~| WARNING shadows a label name that is already in scope
44+
//~| WARNING shadows a label name that is already in scope
45+
//~| WARNING shadows a label name that is already in scope
3046
}
3147
}
3248

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

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

5674
let l: isize = {
5775
'x: for _ in 0..1 {
76+
//~^ WARNING shadows a label name that is already in scope
77+
//~| WARNING shadows a label name that is already in scope
78+
//~| WARNING shadows a label name that is already in scope
79+
//~| WARNING shadows a label name that is already in scope
5880
// ditto
5981
while_true!(break 'x);
6082
i += 1;
@@ -65,6 +87,12 @@ pub fn main() {
6587

6688
let n: isize = {
6789
'x: for _ in 0..1 {
90+
//~^ WARNING shadows a label name that is already in scope
91+
//~| WARNING shadows a label name that is already in scope
92+
//~| WARNING shadows a label name that is already in scope
93+
//~| WARNING shadows a label name that is already in scope
94+
//~| WARNING shadows a label name that is already in scope
95+
//~| WARNING shadows a label name that is already in scope
6896
// ditto
6997
run_once!(continue 'x);
7098
i += 1;

0 commit comments

Comments
 (0)