add test case for issue 105601

This commit is contained in:
yukang 2023-01-14 17:03:25 +08:00
parent c67903ef21
commit 644ee8d250
4 changed files with 104 additions and 0 deletions

View file

@ -0,0 +1,11 @@
#![warn(unused)]
#![deny(warnings)]
fn main() {
let _x: ([u32; 3]); //~ ERROR unnecessary parentheses around type
let _y: [u8; (3)]; //~ ERROR unnecessary parentheses around const expression
let _z: ([u8; (3)]);
//~^ ERROR unnecessary parentheses around const expression
//~| ERROR unnecessary parentheses around type
}

View file

@ -0,0 +1,56 @@
error: unnecessary parentheses around type
--> $DIR/issue-105061-array-lint.rs:5:13
|
LL | let _x: ([u32; 3]);
| ^ ^
|
note: the lint level is defined here
--> $DIR/issue-105061-array-lint.rs:2:9
|
LL | #![deny(warnings)]
| ^^^^^^^^
= note: `#[deny(unused_parens)]` implied by `#[deny(warnings)]`
help: remove these parentheses
|
LL - let _x: ([u32; 3]);
LL + let _x: [u32; 3];
|
error: unnecessary parentheses around const expression
--> $DIR/issue-105061-array-lint.rs:6:18
|
LL | let _y: [u8; (3)];
| ^ ^
|
help: remove these parentheses
|
LL - let _y: [u8; (3)];
LL + let _y: [u8; 3];
|
error: unnecessary parentheses around type
--> $DIR/issue-105061-array-lint.rs:7:13
|
LL | let _z: ([u8; (3)]);
| ^ ^
|
help: remove these parentheses
|
LL - let _z: ([u8; (3)]);
LL + let _z: [u8; (3)];
|
error: unnecessary parentheses around const expression
--> $DIR/issue-105061-array-lint.rs:7:19
|
LL | let _z: ([u8; (3)]);
| ^ ^
|
help: remove these parentheses
|
LL - let _z: ([u8; (3)]);
LL + let _z: ([u8; 3]);
|
error: aborting due to 4 previous errors

View file

@ -0,0 +1,17 @@
#![warn(unused)]
#![deny(warnings)]
struct Inv<'a>(&'a mut &'a ());
trait Trait<'a> {}
impl<'b> Trait<'b> for for<'a> fn(Inv<'a>) {}
fn with_bound()
where
for<'b> (for<'a> fn(Inv<'a>)): Trait<'b>, //~ ERROR unnecessary parentheses around type
{}
fn main() {
with_bound();
}

View file

@ -0,0 +1,20 @@
error: unnecessary parentheses around type
--> $DIR/issue-105061-should-lint.rs:12:13
|
LL | for<'b> (for<'a> fn(Inv<'a>)): Trait<'b>,
| ^ ^
|
note: the lint level is defined here
--> $DIR/issue-105061-should-lint.rs:2:9
|
LL | #![deny(warnings)]
| ^^^^^^^^
= note: `#[deny(unused_parens)]` implied by `#[deny(warnings)]`
help: remove these parentheses
|
LL - for<'b> (for<'a> fn(Inv<'a>)): Trait<'b>,
LL + for<'b> for<'a> fn(Inv<'a>): Trait<'b>,
|
error: aborting due to previous error