From 54fc98920b1f28b5a9ba42a67fcd2868cc0b614a Mon Sep 17 00:00:00 2001 From: Jake Heinz Date: Tue, 30 Nov 2021 03:21:17 +0000 Subject: [PATCH] consts with inners?? --- crates/ide_db/src/symbol_index.rs | 12 ++++ .../test_symbol_index_collection.txt | 72 ++++++++++++++++++- 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 @@ -254,6 +254,28 @@ kind: Module, 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 { @@ -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, }, }, @@ -364,6 +386,52 @@ kind: Macro, 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 {