aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir_def/src/item_tree
diff options
context:
space:
mode:
authorJonas Schievink <[email protected]>2020-07-14 18:57:41 +0100
committerJonas Schievink <[email protected]>2020-07-14 18:57:41 +0100
commita4a8406c449a2c124659773408d0241d54eb243a (patch)
tree2af71e48e9d3fce856e6cd70d754d03345b1d66d /crates/ra_hir_def/src/item_tree
parenta50c64a4f13b47de7fa08eb3e6ff222a96389b28 (diff)
ItemTree: Lower tuple types despite invalid type
Diffstat (limited to 'crates/ra_hir_def/src/item_tree')
-rw-r--r--crates/ra_hir_def/src/item_tree/lower.rs13
1 files changed, 6 insertions, 7 deletions
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 {
219 fn lower_tuple_fields(&mut self, fields: &ast::TupleFieldDefList) -> IdRange<Field> { 219 fn lower_tuple_fields(&mut self, fields: &ast::TupleFieldDefList) -> IdRange<Field> {
220 let start = self.next_field_idx(); 220 let start = self.next_field_idx();
221 for (i, field) in fields.fields().enumerate() { 221 for (i, field) in fields.fields().enumerate() {
222 if let Some(data) = self.lower_tuple_field(i, &field) { 222 let data = self.lower_tuple_field(i, &field);
223 let idx = self.data().fields.alloc(data); 223 let idx = self.data().fields.alloc(data);
224 self.add_attrs(idx.into(), Attrs::new(&field, &self.hygiene)); 224 self.add_attrs(idx.into(), Attrs::new(&field, &self.hygiene));
225 }
226 } 225 }
227 let end = self.next_field_idx(); 226 let end = self.next_field_idx();
228 IdRange::new(start..end) 227 IdRange::new(start..end)
229 } 228 }
230 229
231 fn lower_tuple_field(&mut self, idx: usize, field: &ast::TupleFieldDef) -> Option<Field> { 230 fn lower_tuple_field(&mut self, idx: usize, field: &ast::TupleFieldDef) -> Field {
232 let name = Name::new_tuple_field(idx); 231 let name = Name::new_tuple_field(idx);
233 let visibility = self.lower_visibility(field); 232 let visibility = self.lower_visibility(field);
234 let type_ref = self.lower_type_ref(&field.type_ref()?); 233 let type_ref = self.lower_type_ref_opt(field.type_ref());
235 let res = Field { name, type_ref, visibility }; 234 let res = Field { name, type_ref, visibility };
236 Some(res) 235 res
237 } 236 }
238 237
239 fn lower_union(&mut self, union: &ast::UnionDef) -> Option<FileItemTreeId<Union>> { 238 fn lower_union(&mut self, union: &ast::UnionDef) -> Option<FileItemTreeId<Union>> {