mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-01 06:11:35 +00:00
Make it opt-in
This commit is contained in:
parent
e5a2c6596d
commit
9fdb8f9037
9 changed files with 44 additions and 4 deletions
|
@ -51,6 +51,9 @@ pub trait InternDatabase: SourceDatabase {
|
|||
|
||||
#[salsa::query_group(DefDatabaseStorage)]
|
||||
pub trait DefDatabase: InternDatabase + AstDatabase + Upcast<dyn AstDatabase> {
|
||||
#[salsa::input]
|
||||
fn enable_proc_attr_macros(&self) -> bool;
|
||||
|
||||
#[salsa::invoke(ItemTree::file_item_tree_query)]
|
||||
fn file_item_tree(&self, file_id: HirFileId) -> Arc<ItemTree>;
|
||||
|
||||
|
|
|
@ -1067,6 +1067,10 @@ impl DefCollector<'_> {
|
|||
}
|
||||
}
|
||||
|
||||
if !self.db.enable_proc_attr_macros() {
|
||||
return true;
|
||||
}
|
||||
|
||||
// Not resolved to a derive helper, so try to resolve as a macro.
|
||||
match attr_macro_as_call_id(
|
||||
ast_id,
|
||||
|
|
|
@ -30,12 +30,19 @@ use crate::{
|
|||
crate::db::InternDatabaseStorage,
|
||||
crate::db::DefDatabaseStorage
|
||||
)]
|
||||
#[derive(Default)]
|
||||
pub(crate) struct TestDB {
|
||||
storage: salsa::Storage<TestDB>,
|
||||
events: Mutex<Option<Vec<salsa::Event>>>,
|
||||
}
|
||||
|
||||
impl Default for TestDB {
|
||||
fn default() -> Self {
|
||||
let mut this = Self { storage: Default::default(), events: Default::default() };
|
||||
this.set_enable_proc_attr_macros(true);
|
||||
this
|
||||
}
|
||||
}
|
||||
|
||||
impl Upcast<dyn AstDatabase> for TestDB {
|
||||
fn upcast(&self) -> &(dyn AstDatabase + 'static) {
|
||||
&*self
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue