about summary refs log tree commit diff
diff options
context:
space:
mode:
authorJake Heinz <jh@discordapp.com>2021-11-30 03:21:17 +0000
committerJake Heinz <jh@discordapp.com>2021-11-30 03:21:17 +0000
commit54fc98920b1f28b5a9ba42a67fcd2868cc0b614a (patch)
tree8ca91f0abe703012f6d7e2c5ea3b2d5a62002b69
parent492b169224fae427294abca7710776e2c3784b27 (diff)
downloadrust-54fc98920b1f28b5a9ba42a67fcd2868cc0b614a.tar.gz
rust-54fc98920b1f28b5a9ba42a67fcd2868cc0b614a.zip
consts with inners??
-rw-r--r--crates/ide_db/src/symbol_index.rs12
-rw-r--r--crates/ide_db/src/test_data/test_symbol_index_collection.txt72
2 files changed, 82 insertions, 2 deletions
diff --git a/crates/ide_db/src/symbol_index.rs b/crates/ide_db/src/symbol_index.rs
index 1434aa81c26..52c90a37444 100644
--- a/crates/ide_db/src/symbol_index.rs
+++ b/crates/ide_db/src/symbol_index.rs
@@ -765,6 +765,18 @@ mod a_mod {
     struct StructInModA;
 }
 
+const _: () = {
+    struct StructInUnnamedConst;
+
+    ()
+};
+
+const CONST_WITH_INNER: () = {
+    struct StructInNamedConst;
+
+    ()
+};
+
 mod b_mod;
 
 //- /b_mod.rs
diff --git a/crates/ide_db/src/test_data/test_symbol_index_collection.txt b/crates/ide_db/src/test_data/test_symbol_index_collection.txt
index 4ec4f142dac..fe6eebc4f01 100644
--- a/crates/ide_db/src/test_data/test_symbol_index_collection.txt
+++ b/crates/ide_db/src/test_data/test_symbol_index_collection.txt
@@ -255,6 +255,28 @@
                 container_name: None,
             },
             FileSymbol {
+                name: "CONST_WITH_INNER",
+                loc: DeclarationLocation {
+                    hir_file_id: HirFileId(
+                        FileId(
+                            FileId(
+                                0,
+                            ),
+                        ),
+                    ),
+                    ptr: SyntaxNodePtr {
+                        range: 520..592,
+                        kind: CONST,
+                    },
+                    name_ptr: SyntaxNodePtr {
+                        range: 526..542,
+                        kind: NAME,
+                    },
+                },
+                kind: Const,
+                container_name: None,
+            },
+            FileSymbol {
                 name: "b_mod",
                 loc: DeclarationLocation {
                     hir_file_id: HirFileId(
@@ -265,11 +287,11 @@
                         ),
                     ),
                     ptr: SyntaxNodePtr {
-                        range: 459..469,
+                        range: 594..604,
                         kind: MODULE,
                     },
                     name_ptr: SyntaxNodePtr {
-                        range: 463..468,
+                        range: 598..603,
                         kind: NAME,
                     },
                 },
@@ -365,6 +387,52 @@
                 container_name: None,
             },
             FileSymbol {
+                name: "StructInUnnamedConst",
+                loc: DeclarationLocation {
+                    hir_file_id: HirFileId(
+                        FileId(
+                            FileId(
+                                0,
+                            ),
+                        ),
+                    ),
+                    ptr: SyntaxNodePtr {
+                        range: 479..507,
+                        kind: STRUCT,
+                    },
+                    name_ptr: SyntaxNodePtr {
+                        range: 486..506,
+                        kind: NAME,
+                    },
+                },
+                kind: Struct,
+                container_name: None,
+            },
+            FileSymbol {
+                name: "StructInNamedConst",
+                loc: DeclarationLocation {
+                    hir_file_id: HirFileId(
+                        FileId(
+                            FileId(
+                                0,
+                            ),
+                        ),
+                    ),
+                    ptr: SyntaxNodePtr {
+                        range: 555..581,
+                        kind: STRUCT,
+                    },
+                    name_ptr: SyntaxNodePtr {
+                        range: 562..580,
+                        kind: NAME,
+                    },
+                },
+                kind: Struct,
+                container_name: Some(
+                    "CONST_WITH_INNER",
+                ),
+            },
+            FileSymbol {
                 name: "StructInFn",
                 loc: DeclarationLocation {
                     hir_file_id: HirFileId(