Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/hir-def/src/body.rs')
-rw-r--r--crates/hir-def/src/body.rs11
1 files changed, 3 insertions, 8 deletions
diff --git a/crates/hir-def/src/body.rs b/crates/hir-def/src/body.rs
index c7566b06d0..94210ab33f 100644
--- a/crates/hir-def/src/body.rs
+++ b/crates/hir-def/src/body.rs
@@ -19,7 +19,6 @@ use la_arena::{Arena, ArenaMap};
use limit::Limit;
use profile::Count;
use rustc_hash::FxHashMap;
-use smallvec::SmallVec;
use syntax::{ast, AstNode, AstPtr, SyntaxNodePtr};
use crate::{
@@ -294,10 +293,6 @@ pub struct BodySourceMap {
field_map: FxHashMap<InFile<AstPtr<ast::RecordExprField>>, ExprId>,
field_map_back: FxHashMap<ExprId, InFile<AstPtr<ast::RecordExprField>>>,
- /// Maps a macro call to its lowered expressions, a single one if it expands to an expression,
- /// or multiple if it expands to MacroStmts.
- macro_call_to_exprs: FxHashMap<InFile<AstPtr<ast::MacroCall>>, SmallVec<[ExprId; 1]>>,
-
expansions: FxHashMap<InFile<AstPtr<ast::MacroCall>>, HirFileId>,
/// Diagnostics accumulated during body lowering. These contain `AstPtr`s and so are stored in
@@ -466,9 +461,9 @@ impl BodySourceMap {
self.field_map.get(&src).cloned()
}
- pub fn macro_expansion_expr(&self, node: InFile<&ast::MacroCall>) -> Option<&[ExprId]> {
- let src = node.map(AstPtr::new);
- self.macro_call_to_exprs.get(&src).map(|it| &**it)
+ pub fn macro_expansion_expr(&self, node: InFile<&ast::MacroExpr>) -> Option<ExprId> {
+ let src = node.map(AstPtr::new).map(AstPtr::upcast::<ast::MacroExpr>).map(AstPtr::upcast);
+ self.expr_map.get(&src).copied()
}
/// Get a reference to the body source map's diagnostics.