Add test for assoc fn suggestion on enum variant

This commit is contained in:
Esteban Küber 2024-11-03 17:15:22 +00:00
parent 7c7bb7dc01
commit 06fc531c96
2 changed files with 29 additions and 0 deletions

View File

@ -0,0 +1,15 @@
#[derive(Default)]
enum E {
A {},
B {},
#[default]
C,
}
impl E {
fn f() {}
}
fn main() {
E::A::f(); //~ ERROR failed to resolve: `A` is a variant, not a module
}

View File

@ -0,0 +1,14 @@
error[E0433]: failed to resolve: `A` is a variant, not a module
--> $DIR/assoc-fn-call-on-variant.rs:14:8
|
LL | E::A::f();
| ^ `A` is a variant, not a module
|
help: there is an enum variant `E::A`; try using the variant's enum
|
LL | E();
| ~
error: aborting due to 1 previous error
For more information about this error, try `rustc --explain E0433`.