diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2019-11-25 14:51:17 +0000 |
---|---|---|
committer | GitHub <[email protected]> | 2019-11-25 14:51:17 +0000 |
commit | ecd1204804a2a3c8b9b98e4b9d18feef06ab51c7 (patch) | |
tree | d051e9bb71631cca33a1b4c23bf3f2576d1c0f56 /crates/ra_hir/src/ty | |
parent | be00d74c7b61fb82bdade482e95035a21f9dd736 (diff) | |
parent | 1455663ea15ecbfbe87b4b5be6919aa35dd0b260 (diff) |
Merge #2403
2403: Fixme for union fields r=matklad a=matklad
Co-authored-by: Aleksey Kladov <[email protected]>
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/infer/expr.rs | 2 | ||||
-rw-r--r-- | crates/ra_hir/src/ty/lower.rs | 5 |
3 files changed, 6 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/infer/expr.rs b/crates/ra_hir/src/ty/infer/expr.rs index 1d6df2b7a..994a6d7e9 100644 --- a/crates/ra_hir/src/ty/infer/expr.rs +++ b/crates/ra_hir/src/ty/infer/expr.rs | |||
@@ -263,6 +263,8 @@ impl<'a, D: HirDatabase> InferenceContext<'a, D> { | |||
263 | .clone() | 263 | .clone() |
264 | .subst(&a_ty.parameters) | 264 | .subst(&a_ty.parameters) |
265 | }), | 265 | }), |
266 | // FIXME: | ||
267 | TypeCtor::Adt(Adt::Union(_)) => None, | ||
266 | _ => None, | 268 | _ => None, |
267 | }, | 269 | }, |
268 | _ => None, | 270 | _ => None, |
diff --git a/crates/ra_hir/src/ty/lower.rs b/crates/ra_hir/src/ty/lower.rs index 27cfe00c1..eb51d31bd 100644 --- a/crates/ra_hir/src/ty/lower.rs +++ b/crates/ra_hir/src/ty/lower.rs | |||
@@ -560,7 +560,8 @@ 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::UnionId(it) => (it.resolver(db), db.union_data(it).variant_data.clone()), | ||
564 | VariantId::EnumVariantId(it) => ( | 565 | VariantId::EnumVariantId(it) => ( |
565 | it.parent.resolver(db), | 566 | it.parent.resolver(db), |
566 | db.enum_data(it.parent).variants[it.local_id].variant_data.clone(), | 567 | db.enum_data(it.parent).variants[it.local_id].variant_data.clone(), |
@@ -818,7 +819,7 @@ impl CallableDef { | |||
818 | pub fn krate(self, db: &impl HirDatabase) -> CrateId { | 819 | pub fn krate(self, db: &impl HirDatabase) -> CrateId { |
819 | match self { | 820 | match self { |
820 | CallableDef::FunctionId(f) => f.lookup(db).module(db).krate, | 821 | CallableDef::FunctionId(f) => f.lookup(db).module(db).krate, |
821 | CallableDef::StructId(s) => s.0.module(db).krate, | 822 | CallableDef::StructId(s) => s.module(db).krate, |
822 | CallableDef::EnumVariantId(e) => e.parent.module(db).krate, | 823 | CallableDef::EnumVariantId(e) => e.parent.module(db).krate, |
823 | } | 824 | } |
824 | } | 825 | } |