Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/hir-expand/src/db.rs')
| -rw-r--r-- | crates/hir-expand/src/db.rs | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/crates/hir-expand/src/db.rs b/crates/hir-expand/src/db.rs index 92be93af04..52ab072f9c 100644 --- a/crates/hir-expand/src/db.rs +++ b/crates/hir-expand/src/db.rs @@ -107,13 +107,6 @@ pub trait ExpandDatabase: SourceDatabase { id: AstId<ast::Macro>, ) -> &DeclarativeMacroExpander; - /// Special case of the previous query for procedural macros. We can't LRU - /// proc macros, since they are not deterministic in general, and - /// non-determinism breaks salsa in a very, very, very bad way. - /// @edwin0cheng heroically debugged this once! See #4315 for details - #[salsa::invoke(expand_proc_macro)] - #[salsa::transparent] - fn expand_proc_macro(&self, call: MacroCallId) -> &ExpandResult<tt::TopSubtree>; /// Retrieves the span to be used for a proc-macro expansions spans. /// This is a firewall query as it requires parsing the file, which we don't want proc-macros to /// directly depend on as that would cause to frequent invalidations, mainly because of the @@ -535,8 +528,7 @@ fn macro_expand<'db>( let (ExpandResult { value: (tt, matched_arm), err }, span) = match loc.def.kind { MacroDefKind::ProcMacro(..) => { - return db - .expand_proc_macro(macro_call_id) + return expand_proc_macro(db, macro_call_id) .as_ref() .map(|it| (Cow::Borrowed(it), None)); } @@ -617,6 +609,10 @@ fn proc_macro_span(db: &dyn ExpandDatabase, ast: AstId<ast::Fn>) -> Span { span_map.span_for_range(range) } +/// Special case of [`macro_expand`] for procedural macros. We can't LRU +/// proc macros, since they are not deterministic in general, and +/// non-determinism breaks salsa in a very, very, very bad way. +/// @edwin0cheng heroically debugged this once! See #4315 for details #[salsa_macros::tracked(returns(ref))] fn expand_proc_macro(db: &dyn ExpandDatabase, id: MacroCallId) -> ExpandResult<tt::TopSubtree> { let loc = id.loc(db); |