aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--crates/ra_hir/src/ty/infer/expr.rs2
-rw-r--r--crates/ra_hir/src/ty/lower.rs1
-rw-r--r--crates/ra_hir_def/src/adt.rs5
-rw-r--r--crates/ra_hir_def/src/lib.rs1
4 files changed, 9 insertions, 0 deletions
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 89bc4b9ae..eb51d31bd 100644
--- a/crates/ra_hir/src/ty/lower.rs
+++ b/crates/ra_hir/src/ty/lower.rs
@@ -561,6 +561,7 @@ pub(crate) fn field_types_query(
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).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(),
diff --git a/crates/ra_hir_def/src/adt.rs b/crates/ra_hir_def/src/adt.rs
index 71014826e..0091bfbc3 100644
--- a/crates/ra_hir_def/src/adt.rs
+++ b/crates/ra_hir_def/src/adt.rs
@@ -150,6 +150,11 @@ impl HasChildSource for VariantId {
150 src.map(|map| map[it.local_id].kind()) 150 src.map(|map| map[it.local_id].kind())
151 } 151 }
152 VariantId::StructId(it) => it.source(db).map(|it| it.kind()), 152 VariantId::StructId(it) => it.source(db).map(|it| it.kind()),
153 VariantId::UnionId(it) => it.source(db).map(|it| {
154 it.record_field_def_list()
155 .map(ast::StructKind::Record)
156 .unwrap_or(ast::StructKind::Unit)
157 }),
153 }; 158 };
154 let mut trace = Trace::new_for_map(); 159 let mut trace = Trace::new_for_map();
155 lower_struct(&mut trace, &src.value); 160 lower_struct(&mut trace, &src.value);
diff --git a/crates/ra_hir_def/src/lib.rs b/crates/ra_hir_def/src/lib.rs
index 5f11be114..a88a78b38 100644
--- a/crates/ra_hir_def/src/lib.rs
+++ b/crates/ra_hir_def/src/lib.rs
@@ -431,6 +431,7 @@ impl_froms!(
431pub enum VariantId { 431pub enum VariantId {
432 EnumVariantId(EnumVariantId), 432 EnumVariantId(EnumVariantId),
433 StructId(StructId), 433 StructId(StructId),
434 UnionId(UnionId),
434} 435}
435impl_froms!(VariantId: EnumVariantId, StructId); 436impl_froms!(VariantId: EnumVariantId, StructId);
436 437