From 268f45a099f2010ac1b69d34bfab32c3a2b026c4 Mon Sep 17 00:00:00 2001 From: Jonas Schievink Date: Thu, 18 Mar 2021 19:56:37 +0100 Subject: Record custom derive helpers in `DefMap` Also clean up proc macro attribute parsing a bit --- crates/hir_def/src/nameres.rs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'crates/hir_def/src/nameres.rs') diff --git a/crates/hir_def/src/nameres.rs b/crates/hir_def/src/nameres.rs index c97be584e..1ac326f97 100644 --- a/crates/hir_def/src/nameres.rs +++ b/crates/hir_def/src/nameres.rs @@ -53,11 +53,12 @@ mod path_resolution; #[cfg(test)] mod tests; +mod proc_macro; use std::sync::Arc; use base_db::{CrateId, Edition, FileId}; -use hir_expand::{diagnostics::DiagnosticSink, name::Name, InFile}; +use hir_expand::{diagnostics::DiagnosticSink, name::Name, InFile, MacroDefId}; use la_arena::Arena; use profile::Count; use rustc_hash::FxHashMap; @@ -73,6 +74,8 @@ use crate::{ AstId, BlockId, BlockLoc, LocalModuleId, ModuleDefId, ModuleId, }; +use self::proc_macro::ProcMacroDef; + /// Contains the results of (early) name resolution. /// /// A `DefMap` stores the module tree and the definitions that are in scope in every module after @@ -95,6 +98,12 @@ pub struct DefMap { prelude: Option, extern_prelude: FxHashMap, + /// Side table with additional proc. macro info, for use by name resolution in downstream + /// crates. + /// + /// (the primary purpose is to resolve derive helpers) + exported_proc_macros: FxHashMap, + edition: Edition, diagnostics: Vec, } @@ -237,6 +246,7 @@ impl DefMap { krate, edition, extern_prelude: FxHashMap::default(), + exported_proc_macros: FxHashMap::default(), prelude: None, root, modules, -- cgit v1.2.3