diff options
author | Aleksey Kladov <[email protected]> | 2019-11-25 14:30:50 +0000 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2019-11-25 14:50:49 +0000 |
commit | 5fd68b592938b6a4c074146c1b22ea0f6908fe26 (patch) | |
tree | 3403f802366b9ddf9c9e1c1ff59af3d81e476ad1 /crates/ra_hir/src/ty | |
parent | e1c0bdaf75f8d88a5c28b3e44def17d91d4f46b3 (diff) |
Fix hir for ast::UnionDef
Diffstat (limited to 'crates/ra_hir/src/ty')
-rw-r--r-- | crates/ra_hir/src/ty/infer/coerce.rs | 2 | ||||
-rw-r--r-- | crates/ra_hir/src/ty/lower.rs | 4 |
2 files changed, 3 insertions, 3 deletions
diff --git a/crates/ra_hir/src/ty/infer/coerce.rs b/crates/ra_hir/src/ty/infer/coerce.rs index 4b53bba73..bb9a2e427 100644 --- a/crates/ra_hir/src/ty/infer/coerce.rs +++ b/crates/ra_hir/src/ty/infer/coerce.rs | |||
@@ -246,7 +246,7 @@ impl<'a, D: HirDatabase> InferenceContext<'a, D> { | |||
246 | ty_app!(TypeCtor::Adt(Adt::Struct(struct2)), st2), | 246 | ty_app!(TypeCtor::Adt(Adt::Struct(struct2)), st2), |
247 | ) if struct1 == struct2 => { | 247 | ) if struct1 == struct2 => { |
248 | let field_tys = self.db.field_types(struct1.id.into()); | 248 | let field_tys = self.db.field_types(struct1.id.into()); |
249 | let struct_data = self.db.struct_data(struct1.id.0); | 249 | let struct_data = self.db.struct_data(struct1.id); |
250 | 250 | ||
251 | let mut fields = struct_data.variant_data.fields().iter(); | 251 | let mut fields = struct_data.variant_data.fields().iter(); |
252 | let (last_field_id, _data) = fields.next_back()?; | 252 | let (last_field_id, _data) = fields.next_back()?; |
diff --git a/crates/ra_hir/src/ty/lower.rs b/crates/ra_hir/src/ty/lower.rs index 27cfe00c1..89bc4b9ae 100644 --- a/crates/ra_hir/src/ty/lower.rs +++ b/crates/ra_hir/src/ty/lower.rs | |||
@@ -560,7 +560,7 @@ pub(crate) fn field_types_query( | |||
560 | variant_id: VariantId, | 560 | variant_id: VariantId, |
561 | ) -> Arc<ArenaMap<LocalStructFieldId, Ty>> { | 561 | ) -> Arc<ArenaMap<LocalStructFieldId, Ty>> { |
562 | let (resolver, var_data) = match variant_id { | 562 | let (resolver, var_data) = match variant_id { |
563 | VariantId::StructId(it) => (it.resolver(db), db.struct_data(it.0).variant_data.clone()), | 563 | VariantId::StructId(it) => (it.resolver(db), db.struct_data(it).variant_data.clone()), |
564 | VariantId::EnumVariantId(it) => ( | 564 | VariantId::EnumVariantId(it) => ( |
565 | it.parent.resolver(db), | 565 | it.parent.resolver(db), |
566 | db.enum_data(it.parent).variants[it.local_id].variant_data.clone(), | 566 | db.enum_data(it.parent).variants[it.local_id].variant_data.clone(), |
@@ -818,7 +818,7 @@ impl CallableDef { | |||
818 | pub fn krate(self, db: &impl HirDatabase) -> CrateId { | 818 | pub fn krate(self, db: &impl HirDatabase) -> CrateId { |
819 | match self { | 819 | match self { |
820 | CallableDef::FunctionId(f) => f.lookup(db).module(db).krate, | 820 | CallableDef::FunctionId(f) => f.lookup(db).module(db).krate, |
821 | CallableDef::StructId(s) => s.0.module(db).krate, | 821 | CallableDef::StructId(s) => s.module(db).krate, |
822 | CallableDef::EnumVariantId(e) => e.parent.module(db).krate, | 822 | CallableDef::EnumVariantId(e) => e.parent.module(db).krate, |
823 | } | 823 | } |
824 | } | 824 | } |