mirror of
https://github.com/salsa-rs/salsa.git
synced 2025-01-22 21:05:11 +00:00
Addes test case for !Send + !Sync
This commit is contained in:
parent
5aa0455950
commit
0ba1072c67
1 changed files with 35 additions and 0 deletions
35
tests/no_send_sync.rs
Normal file
35
tests/no_send_sync.rs
Normal 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(());
|
||||
}
|
Loading…
Reference in a new issue