diff options
Diffstat (limited to 'crates/ra_hir_def/src/body')
-rw-r--r-- | crates/ra_hir_def/src/body/lower.rs | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/crates/ra_hir_def/src/body/lower.rs b/crates/ra_hir_def/src/body/lower.rs index 06df88a34..6f56d3d7a 100644 --- a/crates/ra_hir_def/src/body/lower.rs +++ b/crates/ra_hir_def/src/body/lower.rs | |||
@@ -29,8 +29,8 @@ use crate::{ | |||
29 | path::GenericArgs, | 29 | path::GenericArgs, |
30 | path::Path, | 30 | path::Path, |
31 | type_ref::{Mutability, TypeRef}, | 31 | type_ref::{Mutability, TypeRef}, |
32 | AdtId, ConstLoc, ContainerId, DefWithBodyId, EnumLoc, FunctionLoc, HasModule, Intern, | 32 | AdtId, ConstLoc, ContainerId, DefWithBodyId, EnumLoc, FunctionLoc, Intern, ModuleDefId, |
33 | ModuleDefId, StaticLoc, StructLoc, TraitLoc, TypeAliasLoc, UnionLoc, | 33 | StaticLoc, StructLoc, TraitLoc, TypeAliasLoc, UnionLoc, |
34 | }; | 34 | }; |
35 | 35 | ||
36 | use super::{ExprSource, PatSource}; | 36 | use super::{ExprSource, PatSource}; |
@@ -298,7 +298,6 @@ impl ExprCollector<'_> { | |||
298 | self.alloc_expr(Expr::Return { expr }, syntax_ptr) | 298 | self.alloc_expr(Expr::Return { expr }, syntax_ptr) |
299 | } | 299 | } |
300 | ast::Expr::RecordLit(e) => { | 300 | ast::Expr::RecordLit(e) => { |
301 | let crate_graph = self.db.crate_graph(); | ||
302 | let path = e.path().and_then(|path| self.expander.parse_path(path)); | 301 | let path = e.path().and_then(|path| self.expander.parse_path(path)); |
303 | let mut field_ptrs = Vec::new(); | 302 | let mut field_ptrs = Vec::new(); |
304 | let record_lit = if let Some(nfl) = e.record_field_list() { | 303 | let record_lit = if let Some(nfl) = e.record_field_list() { |
@@ -306,10 +305,9 @@ impl ExprCollector<'_> { | |||
306 | .fields() | 305 | .fields() |
307 | .inspect(|field| field_ptrs.push(AstPtr::new(field))) | 306 | .inspect(|field| field_ptrs.push(AstPtr::new(field))) |
308 | .filter_map(|field| { | 307 | .filter_map(|field| { |
309 | let module_id = ContainerId::DefWithBodyId(self.def).module(self.db); | ||
310 | let attrs = self.expander.parse_attrs(&field); | 308 | let attrs = self.expander.parse_attrs(&field); |
311 | 309 | ||
312 | if !attrs.is_cfg_enabled(&crate_graph[module_id.krate].cfg_options) { | 310 | if !self.expander.check_cfg(&attrs) { |
313 | return None; | 311 | return None; |
314 | } | 312 | } |
315 | 313 | ||