diff options
Diffstat (limited to 'crates/ra_hir/src/source_binder.rs')
-rw-r--r-- | crates/ra_hir/src/source_binder.rs | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/crates/ra_hir/src/source_binder.rs b/crates/ra_hir/src/source_binder.rs index d326169b3..b60a6b87e 100644 --- a/crates/ra_hir/src/source_binder.rs +++ b/crates/ra_hir/src/source_binder.rs | |||
@@ -237,7 +237,13 @@ impl SourceAnalyzer { | |||
237 | } | 237 | } |
238 | 238 | ||
239 | pub fn resolve_record_field(&self, field: &ast::RecordField) -> Option<crate::StructField> { | 239 | pub fn resolve_record_field(&self, field: &ast::RecordField) -> Option<crate::StructField> { |
240 | let expr_id = self.expr_id(&field.expr()?)?; | 240 | let expr_id = match field.expr() { |
241 | Some(it) => self.expr_id(&it)?, | ||
242 | None => { | ||
243 | let src = InFile { file_id: self.file_id, value: field }; | ||
244 | self.body_source_map.as_ref()?.field_init_shorthand_expr(src)? | ||
245 | } | ||
246 | }; | ||
241 | self.infer.as_ref()?.record_field_resolution(expr_id).map(|it| it.into()) | 247 | self.infer.as_ref()?.record_field_resolution(expr_id).map(|it| it.into()) |
242 | } | 248 | } |
243 | 249 | ||