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 | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/crates/hir-expand/src/declarative.rs b/crates/hir-expand/src/declarative.rs index fef77acb7b..91cbbc3736 100644 --- a/crates/hir-expand/src/declarative.rs +++ b/crates/hir-expand/src/declarative.rs @@ -102,12 +102,13 @@ impl DeclarativeMacroExpander { }; let ctx_edition = |ctx: SyntaxContextId| { let crate_graph = db.crate_graph(); + if ctx.is_root() { crate_graph[def_crate].edition } else { - let data = db.lookup_intern_syntax_context(ctx); // UNWRAP-SAFETY: Only the root context has no outer expansion - crate_graph[data.outer_expn.unwrap().lookup(db).def.krate].edition + let krate = db.lookup_intern_macro_call(ctx.outer_expn(db).unwrap()).def.krate; + crate_graph[krate].edition } }; let (mac, transparency) = match id.to_ptr(db).to_node(&root) { |