Skip to content

Commit 644ee8d

Browse files
committed
add test case for issue 105601
1 parent c67903e commit 644ee8d

File tree

4 files changed

+104
-0
lines changed

4 files changed

+104
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#![warn(unused)]
2+
#![deny(warnings)]
3+
4+
fn main() {
5+
let _x: ([u32; 3]); //~ ERROR unnecessary parentheses around type
6+
let _y: [u8; (3)]; //~ ERROR unnecessary parentheses around const expression
7+
let _z: ([u8; (3)]);
8+
//~^ ERROR unnecessary parentheses around const expression
9+
//~| ERROR unnecessary parentheses around type
10+
11+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
error: unnecessary parentheses around type
2+
--> $DIR/issue-105061-array-lint.rs:5:13
3+
|
4+
LL | let _x: ([u32; 3]);
5+
| ^ ^
6+
|
7+
note: the lint level is defined here
8+
--> $DIR/issue-105061-array-lint.rs:2:9
9+
|
10+
LL | #![deny(warnings)]
11+
| ^^^^^^^^
12+
= note: `#[deny(unused_parens)]` implied by `#[deny(warnings)]`
13+
help: remove these parentheses
14+
|
15+
LL - let _x: ([u32; 3]);
16+
LL + let _x: [u32; 3];
17+
|
18+
19+
error: unnecessary parentheses around const expression
20+
--> $DIR/issue-105061-array-lint.rs:6:18
21+
|
22+
LL | let _y: [u8; (3)];
23+
| ^ ^
24+
|
25+
help: remove these parentheses
26+
|
27+
LL - let _y: [u8; (3)];
28+
LL + let _y: [u8; 3];
29+
|
30+
31+
error: unnecessary parentheses around type
32+
--> $DIR/issue-105061-array-lint.rs:7:13
33+
|
34+
LL | let _z: ([u8; (3)]);
35+
| ^ ^
36+
|
37+
help: remove these parentheses
38+
|
39+
LL - let _z: ([u8; (3)]);
40+
LL + let _z: [u8; (3)];
41+
|
42+
43+
error: unnecessary parentheses around const expression
44+
--> $DIR/issue-105061-array-lint.rs:7:19
45+
|
46+
LL | let _z: ([u8; (3)]);
47+
| ^ ^
48+
|
49+
help: remove these parentheses
50+
|
51+
LL - let _z: ([u8; (3)]);
52+
LL + let _z: ([u8; 3]);
53+
|
54+
55+
error: aborting due to 4 previous errors
56+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#![warn(unused)]
2+
#![deny(warnings)]
3+
4+
struct Inv<'a>(&'a mut &'a ());
5+
6+
trait Trait<'a> {}
7+
impl<'b> Trait<'b> for for<'a> fn(Inv<'a>) {}
8+
9+
10+
fn with_bound()
11+
where
12+
for<'b> (for<'a> fn(Inv<'a>)): Trait<'b>, //~ ERROR unnecessary parentheses around type
13+
{}
14+
15+
fn main() {
16+
with_bound();
17+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
error: unnecessary parentheses around type
2+
--> $DIR/issue-105061-should-lint.rs:12:13
3+
|
4+
LL | for<'b> (for<'a> fn(Inv<'a>)): Trait<'b>,
5+
| ^ ^
6+
|
7+
note: the lint level is defined here
8+
--> $DIR/issue-105061-should-lint.rs:2:9
9+
|
10+
LL | #![deny(warnings)]
11+
| ^^^^^^^^
12+
= note: `#[deny(unused_parens)]` implied by `#[deny(warnings)]`
13+
help: remove these parentheses
14+
|
15+
LL - for<'b> (for<'a> fn(Inv<'a>)): Trait<'b>,
16+
LL + for<'b> for<'a> fn(Inv<'a>): Trait<'b>,
17+
|
18+
19+
error: aborting due to previous error
20+

0 commit comments

Comments
 (0)