diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2020-07-14 19:09:36 +0100 |
---|---|---|
committer | GitHub <[email protected]> | 2020-07-14 19:09:36 +0100 |
commit | 3f2ab436f45a4fae32514756736055819ead2baa (patch) | |
tree | 2af71e48e9d3fce856e6cd70d754d03345b1d66d /crates/ra_hir_def | |
parent | a50c64a4f13b47de7fa08eb3e6ff222a96389b28 (diff) | |
parent | a4a8406c449a2c124659773408d0241d54eb243a (diff) |
Merge #5381
5381: ItemTree: Lower tuple types despite invalid type r=flodiebold a=jonas-schievink
Fixes https://github.com/rust-analyzer/rust-analyzer/issues/5380
Co-authored-by: Jonas Schievink <[email protected]>
Diffstat (limited to 'crates/ra_hir_def')
-rw-r--r-- | crates/ra_hir_def/src/item_tree/lower.rs | 13 |
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>> { |