implement the Storage<DB> change

This commit is contained in:
Niko Matsakis 2020-07-02 10:31:02 +00:00
parent 4bf46f5f24
commit 67687376ed
22 changed files with 152 additions and 254 deletions

View file

@ -16,16 +16,8 @@ use crate::interner::InternerDatabase;
#[salsa::database(InternerDatabase, CompilerDatabase)]
#[derive(Default)]
pub struct DatabaseImpl {
runtime: salsa::Runtime<DatabaseImpl>,
storage: salsa::Storage<DatabaseImpl>,
}
/// This impl tells salsa where to find the salsa runtime.
impl salsa::Database for DatabaseImpl {
fn salsa_runtime(&self) -> &salsa::Runtime<Self> {
&self.runtime
}
fn salsa_runtime_mut(&mut self) -> &mut salsa::Runtime<Self> {
&mut self.runtime
}
}
impl salsa::Database for DatabaseImpl {}

View file

@ -77,19 +77,10 @@ fn length(db: &impl HelloWorld, (): ()) -> usize {
#[salsa::database(HelloWorldStorage)]
#[derive(Default)]
struct DatabaseStruct {
runtime: salsa::Runtime<DatabaseStruct>,
storage: salsa::Storage<Self>,
}
// Tell salsa where to find the runtime in your context.
impl salsa::Database for DatabaseStruct {
fn salsa_runtime(&self) -> &salsa::Runtime<Self> {
&self.runtime
}
fn salsa_runtime_mut(&mut self) -> &mut salsa::Runtime<Self> {
&mut self.runtime
}
}
impl salsa::Database for DatabaseStruct {}
// ANCHOR_END:database
// This shows how to use a query.