Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/ide-diagnostics/src/handlers/generic_args_prohibited.rs')
-rw-r--r--crates/ide-diagnostics/src/handlers/generic_args_prohibited.rs19
1 files changed, 19 insertions, 0 deletions
diff --git a/crates/ide-diagnostics/src/handlers/generic_args_prohibited.rs b/crates/ide-diagnostics/src/handlers/generic_args_prohibited.rs
index 2b59c1a22f..7d62daf716 100644
--- a/crates/ide-diagnostics/src/handlers/generic_args_prohibited.rs
+++ b/crates/ide-diagnostics/src/handlers/generic_args_prohibited.rs
@@ -604,4 +604,23 @@ fn bar() {
"#,
);
}
+
+ #[test]
+ fn enum_variant_type_ns() {
+ check_diagnostics(
+ r#"
+enum KvnDeserializerErr<I> {
+ UnexpectedKeyword { found: I, expected: I },
+}
+
+fn foo() {
+ let _x: KvnDeserializerErr<()> =
+ KvnDeserializerErr::<()>::UnexpectedKeyword { found: (), expected: () };
+ let _x: KvnDeserializerErr<()> =
+ KvnDeserializerErr::<()>::UnexpectedKeyword::<()> { found: (), expected: () };
+ // ^^^^^^ 💡 error: you can specify generic arguments on either the enum or the variant, but not both
+}
+ "#,
+ );
+ }
}