aboutsummaryrefslogtreecommitdiff
path: root/crates/hir_def/src
diff options
context:
space:
mode:
authorFlorian Diebold <[email protected]>2021-05-23 17:10:40 +0100
committerFlorian Diebold <[email protected]>2021-05-23 17:45:44 +0100
commit7a0c93c58ac17b089edd8c9763fef303b7a81414 (patch)
tree49cb56219cd7aea41376c49252601264ebabcf1a /crates/hir_def/src
parent4a6cdd776d403bacce0a5471d77e8c76695c5bc5 (diff)
Infer correct expected type for generic struct fields
Diffstat (limited to 'crates/hir_def/src')
-rw-r--r--crates/hir_def/src/lib.rs8
1 files changed, 8 insertions, 0 deletions
diff --git a/crates/hir_def/src/lib.rs b/crates/hir_def/src/lib.rs
index a82ea5957..70001cac8 100644
--- a/crates/hir_def/src/lib.rs
+++ b/crates/hir_def/src/lib.rs
@@ -485,6 +485,14 @@ impl VariantId {
485 VariantId::UnionId(it) => it.lookup(db).id.file_id(), 485 VariantId::UnionId(it) => it.lookup(db).id.file_id(),
486 } 486 }
487 } 487 }
488
489 pub fn adt_id(self) -> AdtId {
490 match self {
491 VariantId::EnumVariantId(it) => it.parent.into(),
492 VariantId::StructId(it) => it.into(),
493 VariantId::UnionId(it) => it.into(),
494 }
495 }
488} 496}
489 497
490trait Intern { 498trait Intern {