diff options
Diffstat (limited to 'crates/ra_hir/src/nameres.rs')
-rw-r--r-- | crates/ra_hir/src/nameres.rs | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/crates/ra_hir/src/nameres.rs b/crates/ra_hir/src/nameres.rs index 39152360c..fbfff4fd7 100644 --- a/crates/ra_hir/src/nameres.rs +++ b/crates/ra_hir/src/nameres.rs | |||
@@ -55,7 +55,7 @@ mod tests; | |||
55 | 55 | ||
56 | use std::sync::Arc; | 56 | use std::sync::Arc; |
57 | 57 | ||
58 | use rustc_hash::FxHashMap; | 58 | use rustc_hash::{FxHashMap, FxHashSet}; |
59 | use ra_arena::{Arena, RawId, impl_arena_id}; | 59 | use ra_arena::{Arena, RawId, impl_arena_id}; |
60 | use ra_db::{FileId, Edition}; | 60 | use ra_db::{FileId, Edition}; |
61 | use test_utils::tested_by; | 61 | use test_utils::tested_by; |
@@ -91,6 +91,19 @@ pub struct CrateDefMap { | |||
91 | root: CrateModuleId, | 91 | root: CrateModuleId, |
92 | modules: Arena<CrateModuleId, ModuleData>, | 92 | modules: Arena<CrateModuleId, ModuleData>, |
93 | public_macros: FxHashMap<Name, MacroDefId>, | 93 | public_macros: FxHashMap<Name, MacroDefId>, |
94 | |||
95 | /// Some macros are not well-behavior, which leads to infinite loop | ||
96 | /// e.g. macro_rules! foo { ($ty:ty) => { foo!($ty); } } | ||
97 | /// We mark it down and skip it in collector | ||
98 | /// | ||
99 | /// FIXME: | ||
100 | /// Right now it only handle a poison macro in a single crate, | ||
101 | /// such that if other crate try to call that macro, | ||
102 | /// the whole process will do again until it became poisoned in that crate. | ||
103 | /// We should handle this macro set globally | ||
104 | /// However, do we want to put it as a global variable? | ||
105 | poison_macros: FxHashSet<MacroDefId>, | ||
106 | |||
94 | diagnostics: Vec<DefDiagnostic>, | 107 | diagnostics: Vec<DefDiagnostic>, |
95 | } | 108 | } |
96 | 109 | ||
@@ -195,6 +208,7 @@ impl CrateDefMap { | |||
195 | root, | 208 | root, |
196 | modules, | 209 | modules, |
197 | public_macros: FxHashMap::default(), | 210 | public_macros: FxHashMap::default(), |
211 | poison_macros: FxHashSet::default(), | ||
198 | diagnostics: Vec::new(), | 212 | diagnostics: Vec::new(), |
199 | } | 213 | } |
200 | }; | 214 | }; |