Skip to content

Commit cf2fc3d

Browse files
committed
test: merge crashes/130395.rs into ui/suggestions/incorrect-variant-single-letter.rs
1 parent 6b679d2 commit cf2fc3d

File tree

3 files changed

+42
-17
lines changed

3 files changed

+42
-17
lines changed

tests/crashes/130395.rs

Lines changed: 0 additions & 10 deletions
This file was deleted.

tests/ui/suggestions/incorrect-variant-single-letter.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,15 @@
22

33
enum A {
44
B(),
5+
C(i32),
6+
D(isize, usize),
57
}
68

79
fn foo(_: A) {}
810

911
fn main() {
10-
foo(A::C); //~ ERROR no variant or associated item named `C` found for enum `A` in the current scope [E0599]
12+
// Suggestion could be improved to indicate letter case confusion
13+
foo(A::b); //~ ERROR no variant or associated item named `b` found for enum `A` in the current scope [E0599]
14+
foo(A::c); //~ ERROR no variant or associated item named `c` found for enum `A` in the current scope [E0599]
15+
foo(A::d); //~ ERROR no variant or associated item named `d` found for enum `A` in the current scope [E0599]
1116
}
Lines changed: 36 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,48 @@
1-
error[E0599]: no variant or associated item named `C` found for enum `A` in the current scope
2-
--> $DIR/incorrect-variant-single-letter.rs:10:12
1+
error[E0599]: no variant or associated item named `b` found for enum `A` in the current scope
2+
--> $DIR/incorrect-variant-single-letter.rs:13:12
33
|
44
LL | enum A {
5-
| ------ variant or associated item `C` not found for this enum
5+
| ------ variant or associated item `b` not found for this enum
66
...
7-
LL | foo(A::C);
7+
LL | foo(A::b);
88
| ^ variant or associated item not found in `A`
99
|
1010
help: there is a variant with a similar name
1111
|
12-
LL - foo(A::C);
12+
LL - foo(A::b);
1313
LL + foo(A::B());
1414
|
1515

16-
error: aborting due to 1 previous error
16+
error[E0599]: no variant or associated item named `c` found for enum `A` in the current scope
17+
--> $DIR/incorrect-variant-single-letter.rs:14:12
18+
|
19+
LL | enum A {
20+
| ------ variant or associated item `c` not found for this enum
21+
...
22+
LL | foo(A::c);
23+
| ^ variant or associated item not found in `A`
24+
|
25+
help: there is a variant with a similar name
26+
|
27+
LL - foo(A::c);
28+
LL + foo(A::C(/* i32 */));
29+
|
30+
31+
error[E0599]: no variant or associated item named `d` found for enum `A` in the current scope
32+
--> $DIR/incorrect-variant-single-letter.rs:15:12
33+
|
34+
LL | enum A {
35+
| ------ variant or associated item `d` not found for this enum
36+
...
37+
LL | foo(A::d);
38+
| ^ variant or associated item not found in `A`
39+
|
40+
help: there is a variant with a similar name
41+
|
42+
LL - foo(A::d);
43+
LL + foo(A::D(/* isize */, /* usize */));
44+
|
45+
46+
error: aborting due to 3 previous errors
1747

1848
For more information about this error, try `rustc --explain E0599`.

0 commit comments

Comments
 (0)