about summary refs log tree commit diff
diff options
context:
space:
mode:
authorYoung-Flash <871946895@qq.com>2023-12-27 19:55:36 +0800
committerYoung-Flash <871946895@qq.com>2023-12-27 19:55:36 +0800
commit6a7d3f1c3eda7b46bb4ef7f35a9560ae0d87e97e (patch)
tree4db6c91115df5f923a9291fbd859ccc19b1f769e
parenta38a79e2ba12c80459b81d21be8a59aeb9434f5d (diff)
downloadrust-6a7d3f1c3eda7b46bb4ef7f35a9560ae0d87e97e.tar.gz
rust-6a7d3f1c3eda7b46bb4ef7f35a9560ae0d87e97e.zip
add test case for nested generic arg with `Self`
-rw-r--r--crates/ide-assists/src/handlers/extract_struct_from_enum_variant.rs17
1 files changed, 17 insertions, 0 deletions
diff --git a/crates/ide-assists/src/handlers/extract_struct_from_enum_variant.rs b/crates/ide-assists/src/handlers/extract_struct_from_enum_variant.rs
index 3aa3069a23d..9f81fd932f6 100644
--- a/crates/ide-assists/src/handlers/extract_struct_from_enum_variant.rs
+++ b/crates/ide-assists/src/handlers/extract_struct_from_enum_variant.rs
@@ -467,6 +467,23 @@ enum Foo {
 }
 "#,
         );
+        check_assist(
+            extract_struct_from_enum_variant,
+            r#"
+enum Foo {
+    Bar $0{ node: Box<Self>, a: Arc<Box<Self>> },
+    Nil,
+}
+"#,
+            r#"
+struct Bar{ node: Box<Foo>, a: Arc<Box<Foo>> }
+
+enum Foo {
+    Bar(Bar),
+    Nil,
+}
+"#,
+        );
     }
 
     #[test]