Skip to content

Commit dc19b48

Browse files
Enhance test
Co-authored-by: Centril <[email protected]>
1 parent 3182805 commit dc19b48

File tree

2 files changed

+35
-14
lines changed

2 files changed

+35
-14
lines changed

src/test/ui/pattern/issue-67776-match-same-name-enum-variant-refs.rs

+15-6
Original file line numberDiff line numberDiff line change
@@ -12,20 +12,29 @@ enum Foo {
1212
}
1313

1414

15-
fn fn2(e: Foo) {
15+
fn fn1(e: Foo) {
1616
match e {
17-
Bar => println!("A"),
17+
Bar => {},
1818
//~^ WARNING named the same as one of the variants of the type `Foo`
19-
Baz => println!("B"),
19+
Baz => {},
2020
//~^ WARNING named the same as one of the variants of the type `Foo`
2121
}
2222
}
2323

24-
fn fn1(e: &Foo) {
24+
fn fn2(e: &Foo) {
2525
match e {
26-
Bar => println!("A"),
26+
Bar => {},
2727
//~^ WARNING named the same as one of the variants of the type `Foo`
28-
Baz => println!("B"),
28+
Baz => {},
29+
//~^ WARNING named the same as one of the variants of the type `Foo`
30+
}
31+
}
32+
33+
fn fn3(e: &mut &&mut Foo) {
34+
match e {
35+
Bar => {},
36+
//~^ WARNING named the same as one of the variants of the type `Foo`
37+
Baz => {},
2938
//~^ WARNING named the same as one of the variants of the type `Foo`
3039
}
3140
}
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,36 @@
11
warning[E0170]: pattern binding `Bar` is named the same as one of the variants of the type `Foo`
2-
--> $DIR/match-same-name-enum-variant.rs:14:9
2+
--> $DIR/issue-67776-match-same-name-enum-variant-refs.rs:17:9
33
|
4-
LL | Bar => println!("A"),
4+
LL | Bar => {},
55
| ^^^ help: to match on the variant, qualify the path: `Foo::Bar`
66

77
warning[E0170]: pattern binding `Baz` is named the same as one of the variants of the type `Foo`
8-
--> $DIR/match-same-name-enum-variant.rs:16:9
8+
--> $DIR/issue-67776-match-same-name-enum-variant-refs.rs:19:9
99
|
10-
LL | Baz => println!("B"),
10+
LL | Baz => {},
1111
| ^^^ help: to match on the variant, qualify the path: `Foo::Baz`
1212

1313
warning[E0170]: pattern binding `Bar` is named the same as one of the variants of the type `Foo`
14-
--> $DIR/match-same-name-enum-variant.rs:23:9
14+
--> $DIR/issue-67776-match-same-name-enum-variant-refs.rs:26:9
1515
|
16-
LL | Bar => println!("A"),
16+
LL | Bar => {},
1717
| ^^^ help: to match on the variant, qualify the path: `Foo::Bar`
1818

1919
warning[E0170]: pattern binding `Baz` is named the same as one of the variants of the type `Foo`
20-
--> $DIR/match-same-name-enum-variant.rs:25:9
20+
--> $DIR/issue-67776-match-same-name-enum-variant-refs.rs:28:9
2121
|
22-
LL | Baz => println!("B"),
22+
LL | Baz => {},
23+
| ^^^ help: to match on the variant, qualify the path: `Foo::Baz`
24+
25+
warning[E0170]: pattern binding `Bar` is named the same as one of the variants of the type `Foo`
26+
--> $DIR/issue-67776-match-same-name-enum-variant-refs.rs:35:9
27+
|
28+
LL | Bar => {},
29+
| ^^^ help: to match on the variant, qualify the path: `Foo::Bar`
30+
31+
warning[E0170]: pattern binding `Baz` is named the same as one of the variants of the type `Foo`
32+
--> $DIR/issue-67776-match-same-name-enum-variant-refs.rs:37:9
33+
|
34+
LL | Baz => {},
2335
| ^^^ help: to match on the variant, qualify the path: `Foo::Baz`
2436

0 commit comments

Comments
 (0)