aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_ide_api
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2019-11-25 14:30:50 +0000
committerAleksey Kladov <[email protected]>2019-11-25 14:50:49 +0000
commit5fd68b592938b6a4c074146c1b22ea0f6908fe26 (patch)
tree3403f802366b9ddf9c9e1c1ff59af3d81e476ad1 /crates/ra_ide_api
parente1c0bdaf75f8d88a5c28b3e44def17d91d4f46b3 (diff)
Fix hir for ast::UnionDef
Diffstat (limited to 'crates/ra_ide_api')
-rw-r--r--crates/ra_ide_api/src/display/short_label.rs6
-rw-r--r--crates/ra_ide_api/src/impls.rs4
2 files changed, 10 insertions, 0 deletions
diff --git a/crates/ra_ide_api/src/display/short_label.rs b/crates/ra_ide_api/src/display/short_label.rs
index 5d2bce3d2..9ffc9b980 100644
--- a/crates/ra_ide_api/src/display/short_label.rs
+++ b/crates/ra_ide_api/src/display/short_label.rs
@@ -19,6 +19,12 @@ impl ShortLabel for ast::StructDef {
19 } 19 }
20} 20}
21 21
22impl ShortLabel for ast::UnionDef {
23 fn short_label(&self) -> Option<String> {
24 short_label_from_node(self, "union ")
25 }
26}
27
22impl ShortLabel for ast::EnumDef { 28impl ShortLabel for ast::EnumDef {
23 fn short_label(&self) -> Option<String> { 29 fn short_label(&self) -> Option<String> {
24 short_label_from_node(self, "enum ") 30 short_label_from_node(self, "enum ")
diff --git a/crates/ra_ide_api/src/impls.rs b/crates/ra_ide_api/src/impls.rs
index 3e3012559..2b3100fc3 100644
--- a/crates/ra_ide_api/src/impls.rs
+++ b/crates/ra_ide_api/src/impls.rs
@@ -49,6 +49,10 @@ fn impls_for_def(
49 let src = hir::Source { file_id: position.file_id.into(), value: def.clone() }; 49 let src = hir::Source { file_id: position.file_id.into(), value: def.clone() };
50 hir::Enum::from_source(db, src)?.ty(db) 50 hir::Enum::from_source(db, src)?.ty(db)
51 } 51 }
52 ast::NominalDef::UnionDef(def) => {
53 let src = hir::Source { file_id: position.file_id.into(), value: def.clone() };
54 hir::Union::from_source(db, src)?.ty(db)
55 }
52 }; 56 };
53 57
54 let krate = module.krate(); 58 let krate = module.krate();