mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-11-02 04:48:13 +00:00
Bump salsa
This commit is contained in:
parent
76ee900d7c
commit
cbff4ae151
10 changed files with 83 additions and 280 deletions
|
|
@ -85,7 +85,7 @@ impl LangItemTarget {
|
|||
}
|
||||
|
||||
/// Salsa query. This will look for lang items in a specific crate.
|
||||
#[salsa_macros::tracked(return_ref)]
|
||||
#[salsa_macros::tracked(returns(ref))]
|
||||
pub fn crate_lang_items(db: &dyn DefDatabase, krate: Crate) -> Option<Box<LangItems>> {
|
||||
let _p = tracing::info_span!("crate_lang_items_query").entered();
|
||||
|
||||
|
|
|
|||
|
|
@ -381,15 +381,15 @@ mod __ {
|
|||
#[salsa_macros::tracked]
|
||||
pub(crate) struct DefMapPair<'db> {
|
||||
#[tracked]
|
||||
#[return_ref]
|
||||
#[returns(ref)]
|
||||
pub(crate) def_map: DefMap,
|
||||
#[return_ref]
|
||||
#[returns(ref)]
|
||||
pub(crate) local: LocalDefMap,
|
||||
}
|
||||
}
|
||||
pub(crate) use __::DefMapPair;
|
||||
|
||||
#[salsa_macros::tracked(return_ref)]
|
||||
#[salsa_macros::tracked(returns(ref))]
|
||||
pub(crate) fn crate_local_def_map(db: &dyn DefDatabase, crate_id: Crate) -> DefMapPair<'_> {
|
||||
let krate = crate_id.data(db);
|
||||
let _p = tracing::info_span!(
|
||||
|
|
@ -420,7 +420,7 @@ pub(crate) fn crate_local_def_map(db: &dyn DefDatabase, crate_id: Crate) -> DefM
|
|||
DefMapPair::new(db, def_map, local_def_map)
|
||||
}
|
||||
|
||||
#[salsa_macros::tracked(return_ref)]
|
||||
#[salsa_macros::tracked(returns(ref))]
|
||||
pub fn block_def_map(db: &dyn DefDatabase, block_id: BlockId) -> DefMap {
|
||||
let BlockLoc { ast_id, module } = block_id.lookup(db);
|
||||
|
||||
|
|
|
|||
|
|
@ -30,9 +30,18 @@ pub(crate) struct TestDB {
|
|||
|
||||
impl Default for TestDB {
|
||||
fn default() -> Self {
|
||||
let events = <Arc<Mutex<Option<Vec<salsa::Event>>>>>::default();
|
||||
let mut this = Self {
|
||||
storage: Default::default(),
|
||||
events: Default::default(),
|
||||
storage: salsa::Storage::new(Some(Box::new({
|
||||
let events = events.clone();
|
||||
move |event| {
|
||||
let mut events = events.lock().unwrap();
|
||||
if let Some(events) = &mut *events {
|
||||
events.push(event);
|
||||
}
|
||||
}
|
||||
}))),
|
||||
events,
|
||||
files: Default::default(),
|
||||
crates_map: Default::default(),
|
||||
};
|
||||
|
|
@ -45,15 +54,7 @@ impl Default for TestDB {
|
|||
}
|
||||
|
||||
#[salsa_macros::db]
|
||||
impl salsa::Database for TestDB {
|
||||
fn salsa_event(&self, event: &dyn std::ops::Fn() -> salsa::Event) {
|
||||
let mut events = self.events.lock().unwrap();
|
||||
if let Some(events) = &mut *events {
|
||||
let event = event();
|
||||
events.push(event);
|
||||
}
|
||||
}
|
||||
}
|
||||
impl salsa::Database for TestDB {}
|
||||
|
||||
impl fmt::Debug for TestDB {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue