aboutsummaryrefslogtreecommitdiff
path: root/crates/hir_def/src
diff options
context:
space:
mode:
authorJonas Schievink <[email protected]>2021-04-06 16:59:18 +0100
committerJonas Schievink <[email protected]>2021-04-06 16:59:18 +0100
commite9752308bbaa2fd720e1eeaca970977fe22514d1 (patch)
treeb391af28f6bfaee53effcc64aeab325e95b5b461 /crates/hir_def/src
parent74711deb724e0a6c84a221bfdfa15eaedbdb2300 (diff)
infer: remove `record_field_resolutions` field
It stores no useful data, since we can derive all fields from `variant_resolutions`
Diffstat (limited to 'crates/hir_def/src')
-rw-r--r--crates/hir_def/src/lib.rs13
1 files changed, 13 insertions, 0 deletions
diff --git a/crates/hir_def/src/lib.rs b/crates/hir_def/src/lib.rs
index be9a5e1a0..abd6c553f 100644
--- a/crates/hir_def/src/lib.rs
+++ b/crates/hir_def/src/lib.rs
@@ -56,6 +56,7 @@ use std::{
56 sync::Arc, 56 sync::Arc,
57}; 57};
58 58
59use adt::VariantData;
59use base_db::{impl_intern_key, salsa, CrateId}; 60use base_db::{impl_intern_key, salsa, CrateId};
60use hir_expand::{ 61use hir_expand::{
61 ast_id_map::FileAstId, 62 ast_id_map::FileAstId,
@@ -442,6 +443,18 @@ pub enum VariantId {
442} 443}
443impl_from!(EnumVariantId, StructId, UnionId for VariantId); 444impl_from!(EnumVariantId, StructId, UnionId for VariantId);
444 445
446impl VariantId {
447 pub fn variant_data(self, db: &dyn db::DefDatabase) -> Arc<VariantData> {
448 match self {
449 VariantId::StructId(it) => db.struct_data(it).variant_data.clone(),
450 VariantId::UnionId(it) => db.union_data(it).variant_data.clone(),
451 VariantId::EnumVariantId(it) => {
452 db.enum_data(it.parent).variants[it.local_id].variant_data.clone()
453 }
454 }
455 }
456}
457
445trait Intern { 458trait Intern {
446 type ID; 459 type ID;
447 fn intern(self, db: &dyn db::DefDatabase) -> Self::ID; 460 fn intern(self, db: &dyn db::DefDatabase) -> Self::ID;