mirror of
https://github.com/astral-sh/ruff.git
synced 2025-08-04 02:39:12 +00:00
Update salsa (#12711)
This commit is contained in:
parent
8e6aa78796
commit
846f57fd15
19 changed files with 92 additions and 131 deletions
|
@ -252,6 +252,13 @@ impl Files {
|
|||
.to(FileRevision::now());
|
||||
}
|
||||
}
|
||||
|
||||
#[must_use]
|
||||
pub fn snapshot(&self) -> Self {
|
||||
Self {
|
||||
inner: Arc::clone(&self.inner),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl std::fmt::Debug for Files {
|
||||
|
@ -265,6 +272,8 @@ impl std::fmt::Debug for Files {
|
|||
}
|
||||
}
|
||||
|
||||
impl std::panic::RefUnwindSafe for Files {}
|
||||
|
||||
/// A file that's either stored on the host system's file system or in the vendored file system.
|
||||
#[salsa::input]
|
||||
pub struct File {
|
||||
|
|
|
@ -23,7 +23,6 @@ pub type FxDashSet<K> = dashmap::DashSet<K, BuildHasherDefault<FxHasher>>;
|
|||
pub trait Db: salsa::Database {
|
||||
fn vendored(&self) -> &VendoredFileSystem;
|
||||
fn system(&self) -> &dyn System;
|
||||
fn system_mut(&mut self) -> &mut dyn System;
|
||||
fn files(&self) -> &Files;
|
||||
}
|
||||
|
||||
|
@ -104,10 +103,6 @@ mod tests {
|
|||
&self.system
|
||||
}
|
||||
|
||||
fn system_mut(&mut self) -> &mut dyn System {
|
||||
&mut self.system
|
||||
}
|
||||
|
||||
fn files(&self) -> &Files {
|
||||
&self.files
|
||||
}
|
||||
|
@ -125,12 +120,11 @@ mod tests {
|
|||
|
||||
#[salsa::db]
|
||||
impl salsa::Database for TestDb {
|
||||
fn salsa_event(&self, event: salsa::Event) {
|
||||
salsa::Database::attach(self, |_| {
|
||||
tracing::trace!("event: {:?}", event);
|
||||
let mut events = self.events.lock().unwrap();
|
||||
events.push(event);
|
||||
});
|
||||
fn salsa_event(&self, event: &dyn Fn() -> salsa::Event) {
|
||||
let event = event();
|
||||
tracing::trace!("event: {:?}", event);
|
||||
let mut events = self.events.lock().unwrap();
|
||||
events.push(event);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -76,9 +76,7 @@ where
|
|||
|
||||
let event = events.iter().find(|event| {
|
||||
if let salsa::EventKind::WillExecute { database_key } = event.kind {
|
||||
db.lookup_ingredient(database_key.ingredient_index())
|
||||
.debug_name()
|
||||
== query_name
|
||||
db.ingredient_debug_name(database_key.ingredient_index()) == query_name
|
||||
&& database_key.key_index() == input.as_id()
|
||||
} else {
|
||||
false
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue