Skip to content

Commit 06fc531

Browse files
committed
Add test for assoc fn suggestion on enum variant
1 parent 7c7bb7d commit 06fc531

File tree

2 files changed

+29
-0
lines changed

2 files changed

+29
-0
lines changed
+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#[derive(Default)]
2+
enum E {
3+
A {},
4+
B {},
5+
#[default]
6+
C,
7+
}
8+
9+
impl E {
10+
fn f() {}
11+
}
12+
13+
fn main() {
14+
E::A::f(); //~ ERROR failed to resolve: `A` is a variant, not a module
15+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
error[E0433]: failed to resolve: `A` is a variant, not a module
2+
--> $DIR/assoc-fn-call-on-variant.rs:14:8
3+
|
4+
LL | E::A::f();
5+
| ^ `A` is a variant, not a module
6+
|
7+
help: there is an enum variant `E::A`; try using the variant's enum
8+
|
9+
LL | E();
10+
| ~
11+
12+
error: aborting due to 1 previous error
13+
14+
For more information about this error, try `rustc --explain E0433`.

0 commit comments

Comments
 (0)