@@ -18,10 +18,7 @@ use std::{iter, mem, sync::atomic::AtomicUsize, time::Duration};
1818use hir:: { ChangeWithProcMacros , ProcMacrosBuilder } ;
1919use ide_db:: {
2020 FxHashMap ,
21- base_db:: {
22- CrateGraphBuilder , ProcMacroLoadingError , ProcMacroPaths ,
23- salsa:: { Durability , Setter } ,
24- } ,
21+ base_db:: { CrateGraphBuilder , ProcMacroLoadingError , ProcMacroPaths , salsa:: Durability } ,
2522} ;
2623use itertools:: Itertools ;
2724use load_cargo:: { ProjectFolders , load_proc_macro} ;
@@ -112,20 +109,16 @@ impl GlobalState {
112109 self . reload_flycheck ( ) ;
113110 }
114111
115- // TODO: `ide`'s Cargo.toml says that it should avoid depending on `hir-*` crates directly,
116- // and go through `hir` re-exports instead. `rust-analyzer` OTOH does seems to depend on `hir-*`
117- // after all. So, should I import `ExpandProcAttrMacros` through `hir` or `hir_def`?
118- // TODO: should I create `AnalysisHost::{update_,}expand_proc_attr_macros` to clean this up?
119112 // TODO: we don't use `raw_db` mutably until we go into the `if` -- is it a problem that I
120113 // still get it mutably in an eager manner? I did this to avoid needing two separate calls, to
121114 // `raw_database` and `raw_database_mut`. Or maybe I should just inline `raw_db`?
122115 let raw_db = self . analysis_host . raw_database_mut ( ) ;
123- let expand_proc_macros = hir:: db:: ExpandProcAttrMacros :: get ( raw_db) ;
124- if expand_proc_macros . enabled ( raw_db ) != self . config . expand_proc_attr_macros ( ) {
125- expand_proc_macros
126- . set_enabled ( raw_db )
127- . with_durability ( Durability :: HIGH )
128- . to ( self . config . expand_proc_attr_macros ( ) ) ;
116+ if hir:: db:: get_expand_proc_attr_macros ( raw_db) != self . config . expand_proc_attr_macros ( ) {
117+ hir :: db :: set_expand_proc_attr_macros_with_durability (
118+ raw_db ,
119+ self . config . expand_proc_attr_macros ( ) ,
120+ Durability :: HIGH ,
121+ ) ;
129122 }
130123
131124 if self . config . cargo ( None ) != old_config. cargo ( None ) {
0 commit comments