Addes test case for !Send + !Sync

This commit is contained in:
Vincent Esche 2019-03-27 10:35:09 +01:00
parent 5aa0455950
commit 0ba1072c67

35
tests/no_send_sync.rs Normal file
View file

@ -0,0 +1,35 @@
#[macro_use]
extern crate salsa;
use std::rc::Rc;
// #[derive(Clone, PartialEq, Eq, Debug)]
// struct Dummy;
#[salsa::query_group(NoSendStorage)]
trait NoSendDatabase: salsa::Database {
fn query(&self, key: ()) -> Rc<bool>;
}
fn query(db: &impl NoSendDatabase, (): ()) -> Rc<bool> {
Rc::new(true)
}
#[salsa::database(NoSendStorage)]
#[derive(Default)]
struct DatabaseImpl {
runtime: salsa::Runtime<DatabaseImpl>,
}
impl salsa::Database for DatabaseImpl {
fn salsa_runtime(&self) -> &salsa::Runtime<DatabaseImpl> {
&self.runtime
}
}
#[test]
fn no_send_sync() {
let mut db = DatabaseImpl::default();
db.query(());
}