Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/hir-expand/src/declarative.rs')
| -rw-r--r-- | crates/hir-expand/src/declarative.rs | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/crates/hir-expand/src/declarative.rs b/crates/hir-expand/src/declarative.rs index 9a0b218e6d..f9ea8e2ea5 100644 --- a/crates/hir-expand/src/declarative.rs +++ b/crates/hir-expand/src/declarative.rs @@ -2,7 +2,7 @@ use std::sync::OnceLock; use base_db::{CrateId, VersionReq}; -use span::{MacroCallId, Span, SyntaxContextId}; +use span::{Edition, MacroCallId, Span, SyntaxContextId}; use syntax::{ast, AstNode}; use triomphe::Arc; @@ -56,6 +56,7 @@ impl DeclarativeMacroExpander { |s| s.ctx = apply_mark(db, s.ctx, call_id, self.transparency), new_meta_vars, span, + loc.def.edition, ) .map_err(Into::into), } @@ -67,6 +68,7 @@ impl DeclarativeMacroExpander { tt: tt::Subtree, krate: CrateId, call_site: Span, + def_site_edition: Edition, ) -> ExpandResult<tt::Subtree> { let toolchain = db.toolchain(krate); let new_meta_vars = toolchain.as_ref().map_or(false, |version| { @@ -85,7 +87,10 @@ impl DeclarativeMacroExpander { tt::Subtree::empty(tt::DelimSpan { open: call_site, close: call_site }), ExpandError::MacroDefinition, ), - None => self.mac.expand(&tt, |_| (), new_meta_vars, call_site).map_err(Into::into), + None => self + .mac + .expand(&tt, |_| (), new_meta_vars, call_site, def_site_edition) + .map_err(Into::into), } } |