diff options
Diffstat (limited to 'crates/hir_def/src/body.rs')
-rw-r--r-- | crates/hir_def/src/body.rs | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/crates/hir_def/src/body.rs b/crates/hir_def/src/body.rs index 16e1bac40..19c4eb521 100644 --- a/crates/hir_def/src/body.rs +++ b/crates/hir_def/src/body.rs | |||
@@ -20,7 +20,6 @@ use la_arena::{Arena, ArenaMap}; | |||
20 | use profile::Count; | 20 | use profile::Count; |
21 | use rustc_hash::FxHashMap; | 21 | use rustc_hash::FxHashMap; |
22 | use syntax::{ast, AstNode, AstPtr}; | 22 | use syntax::{ast, AstNode, AstPtr}; |
23 | use test_utils::mark; | ||
24 | 23 | ||
25 | pub(crate) use lower::LowerCtx; | 24 | pub(crate) use lower::LowerCtx; |
26 | 25 | ||
@@ -29,11 +28,10 @@ use crate::{ | |||
29 | db::DefDatabase, | 28 | db::DefDatabase, |
30 | expr::{Expr, ExprId, Label, LabelId, Pat, PatId}, | 29 | expr::{Expr, ExprId, Label, LabelId, Pat, PatId}, |
31 | item_scope::BuiltinShadowMode, | 30 | item_scope::BuiltinShadowMode, |
32 | item_scope::ItemScope, | ||
33 | nameres::DefMap, | 31 | nameres::DefMap, |
34 | path::{ModPath, Path}, | 32 | path::{ModPath, Path}, |
35 | src::HasSource, | 33 | src::HasSource, |
36 | AsMacroCall, DefWithBodyId, HasModule, LocalModuleId, Lookup, ModuleId, | 34 | AsMacroCall, BlockId, DefWithBodyId, HasModule, LocalModuleId, Lookup, ModuleId, |
37 | }; | 35 | }; |
38 | 36 | ||
39 | /// A subset of Expander that only deals with cfg attributes. We only need it to | 37 | /// A subset of Expander that only deals with cfg attributes. We only need it to |
@@ -105,7 +103,7 @@ impl Expander { | |||
105 | macro_call: ast::MacroCall, | 103 | macro_call: ast::MacroCall, |
106 | ) -> ExpandResult<Option<(Mark, T)>> { | 104 | ) -> ExpandResult<Option<(Mark, T)>> { |
107 | if self.recursion_limit + 1 > EXPANSION_RECURSION_LIMIT { | 105 | if self.recursion_limit + 1 > EXPANSION_RECURSION_LIMIT { |
108 | mark::hit!(your_stack_belongs_to_me); | 106 | cov_mark::hit!(your_stack_belongs_to_me); |
109 | return ExpandResult::str_err("reached recursion limit during macro expansion".into()); | 107 | return ExpandResult::str_err("reached recursion limit during macro expansion".into()); |
110 | } | 108 | } |
111 | 109 | ||
@@ -227,7 +225,8 @@ pub struct Body { | |||
227 | pub params: Vec<PatId>, | 225 | pub params: Vec<PatId>, |
228 | /// The `ExprId` of the actual body expression. | 226 | /// The `ExprId` of the actual body expression. |
229 | pub body_expr: ExprId, | 227 | pub body_expr: ExprId, |
230 | pub item_scope: ItemScope, | 228 | /// Block expressions in this body that may contain inner items. |
229 | pub block_scopes: Vec<BlockId>, | ||
231 | _c: Count<Self>, | 230 | _c: Count<Self>, |
232 | } | 231 | } |
233 | 232 | ||
@@ -296,7 +295,7 @@ impl Body { | |||
296 | } | 295 | } |
297 | }; | 296 | }; |
298 | let expander = Expander::new(db, file_id, module); | 297 | let expander = Expander::new(db, file_id, module); |
299 | let (body, source_map) = Body::new(db, def, expander, params, body); | 298 | let (body, source_map) = Body::new(db, expander, params, body); |
300 | (Arc::new(body), Arc::new(source_map)) | 299 | (Arc::new(body), Arc::new(source_map)) |
301 | } | 300 | } |
302 | 301 | ||
@@ -306,12 +305,11 @@ impl Body { | |||
306 | 305 | ||
307 | fn new( | 306 | fn new( |
308 | db: &dyn DefDatabase, | 307 | db: &dyn DefDatabase, |
309 | def: DefWithBodyId, | ||
310 | expander: Expander, | 308 | expander: Expander, |
311 | params: Option<ast::ParamList>, | 309 | params: Option<ast::ParamList>, |
312 | body: Option<ast::Expr>, | 310 | body: Option<ast::Expr>, |
313 | ) -> (Body, BodySourceMap) { | 311 | ) -> (Body, BodySourceMap) { |
314 | lower::lower(db, def, expander, params, body) | 312 | lower::lower(db, expander, params, body) |
315 | } | 313 | } |
316 | } | 314 | } |
317 | 315 | ||