From a4a8406c449a2c124659773408d0241d54eb243a Mon Sep 17 00:00:00 2001 From: Jonas Schievink Date: Tue, 14 Jul 2020 19:57:41 +0200 Subject: ItemTree: Lower tuple types despite invalid type --- crates/ra_hir_def/src/item_tree/lower.rs | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'crates/ra_hir_def/src') diff --git a/crates/ra_hir_def/src/item_tree/lower.rs b/crates/ra_hir_def/src/item_tree/lower.rs index 0b1509e13..4182a9e3b 100644 --- a/crates/ra_hir_def/src/item_tree/lower.rs +++ b/crates/ra_hir_def/src/item_tree/lower.rs @@ -219,21 +219,20 @@ impl Ctx { fn lower_tuple_fields(&mut self, fields: &ast::TupleFieldDefList) -> IdRange { let start = self.next_field_idx(); for (i, field) in fields.fields().enumerate() { - if let Some(data) = self.lower_tuple_field(i, &field) { - let idx = self.data().fields.alloc(data); - self.add_attrs(idx.into(), Attrs::new(&field, &self.hygiene)); - } + let data = self.lower_tuple_field(i, &field); + let idx = self.data().fields.alloc(data); + self.add_attrs(idx.into(), Attrs::new(&field, &self.hygiene)); } let end = self.next_field_idx(); IdRange::new(start..end) } - fn lower_tuple_field(&mut self, idx: usize, field: &ast::TupleFieldDef) -> Option { + fn lower_tuple_field(&mut self, idx: usize, field: &ast::TupleFieldDef) -> Field { let name = Name::new_tuple_field(idx); let visibility = self.lower_visibility(field); - let type_ref = self.lower_type_ref(&field.type_ref()?); + let type_ref = self.lower_type_ref_opt(field.type_ref()); let res = Field { name, type_ref, visibility }; - Some(res) + res } fn lower_union(&mut self, union: &ast::UnionDef) -> Option> { -- cgit v1.2.3