adopt salsa::database attribute macro

This commit is contained in:
Niko Matsakis 2019-01-24 19:02:56 -05:00
parent 3fc02c6c0c
commit a8d9fb2d6b
13 changed files with 55 additions and 159 deletions

View file

@ -13,6 +13,7 @@ use crate::compiler::{CompilerDatabase, Interner};
/// to your context (e.g., a shared counter or some such thing). If
/// mutations to that shared state affect the results of your queries,
/// that's going to mess up the incremental results.
#[salsa::database(class_table::ClassTableDatabase)]
#[derive(Default)]
pub struct DatabaseImpl {
runtime: salsa::Runtime<DatabaseImpl>,
@ -31,17 +32,6 @@ impl salsa::Database for DatabaseImpl {
}
}
/// Declares the "query storage" for your context. Here, you list out
/// all of the query traits from your application that you wish to
/// provide storage for. This macro will generate the appropriate
/// storage and also generate impls for those traits, so that you
/// `DatabaseImpl` type implements them.
salsa::database_storage! {
pub DatabaseImpl {
impl class_table::ClassTableDatabase;
}
}
/// In addition to the "query provider" traits, you may have other
/// trait requirements that your application needs -- you can
/// implement those yourself (in this case, an `interner`).