diff options
author | Benjamin Coenen <[email protected]> | 2020-04-09 17:37:34 +0100 |
---|---|---|
committer | Benjamin Coenen <[email protected]> | 2020-04-09 18:12:50 +0100 |
commit | c1317d692321ba5ba8f138067ebefbb9559d098d (patch) | |
tree | e29a44577e4d2cf55b6f53e3428abea43bbd33d7 /crates/ra_hir_def/src/body/lower.rs | |
parent | fc70cf9458c5234decafdd52b9aced790ac43d7a (diff) | |
parent | 30f0ad159a0f260f54356385de63c171722adb72 (diff) |
feat: add support for feature attributes in struct literal
Signed-off-by: Benjamin Coenen <[email protected]>
Diffstat (limited to 'crates/ra_hir_def/src/body/lower.rs')
-rw-r--r-- | crates/ra_hir_def/src/body/lower.rs | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/crates/ra_hir_def/src/body/lower.rs b/crates/ra_hir_def/src/body/lower.rs index 06145e92a..032037c8c 100644 --- a/crates/ra_hir_def/src/body/lower.rs +++ b/crates/ra_hir_def/src/body/lower.rs | |||
@@ -497,14 +497,16 @@ impl ExprCollector<'_> { | |||
497 | self.collect_block_items(&block); | 497 | self.collect_block_items(&block); |
498 | let statements = block | 498 | let statements = block |
499 | .statements() | 499 | .statements() |
500 | .map(|s| match s { | 500 | .filter_map(|s| match s { |
501 | ast::Stmt::LetStmt(stmt) => { | 501 | ast::Stmt::LetStmt(stmt) => { |
502 | let pat = self.collect_pat_opt(stmt.pat()); | 502 | let pat = self.collect_pat_opt(stmt.pat()); |
503 | let type_ref = stmt.ascribed_type().map(TypeRef::from_ast); | 503 | let type_ref = stmt.ascribed_type().map(TypeRef::from_ast); |
504 | let initializer = stmt.initializer().map(|e| self.collect_expr(e)); | 504 | let initializer = stmt.initializer().map(|e| self.collect_expr(e)); |
505 | Statement::Let { pat, type_ref, initializer } | 505 | Some(Statement::Let { pat, type_ref, initializer }) |
506 | } | ||
507 | ast::Stmt::ExprStmt(stmt) => { | ||
508 | Some(Statement::Expr(self.collect_expr_opt(stmt.expr()))) | ||
506 | } | 509 | } |
507 | ast::Stmt::ExprStmt(stmt) => Statement::Expr(self.collect_expr_opt(stmt.expr())), | ||
508 | }) | 510 | }) |
509 | .collect(); | 511 | .collect(); |
510 | let tail = block.expr().map(|e| self.collect_expr(e)); | 512 | let tail = block.expr().map(|e| self.collect_expr(e)); |
@@ -556,6 +558,7 @@ impl ExprCollector<'_> { | |||
556 | let ast_id = self.expander.ast_id(&def); | 558 | let ast_id = self.expander.ast_id(&def); |
557 | (TraitLoc { container, ast_id }.intern(self.db).into(), def.name()) | 559 | (TraitLoc { container, ast_id }.intern(self.db).into(), def.name()) |
558 | } | 560 | } |
561 | ast::ModuleItem::ExternBlock(_) => continue, // FIXME: collect from extern blocks | ||
559 | ast::ModuleItem::ImplDef(_) | 562 | ast::ModuleItem::ImplDef(_) |
560 | | ast::ModuleItem::UseItem(_) | 563 | | ast::ModuleItem::UseItem(_) |
561 | | ast::ModuleItem::ExternCrateItem(_) | 564 | | ast::ModuleItem::ExternCrateItem(_) |