From 0ba1072c6702e9ed71bea7ea4d25a6e2efff1a0d Mon Sep 17 00:00:00 2001 From: Vincent Esche Date: Wed, 27 Mar 2019 10:35:09 +0100 Subject: [PATCH] Addes test case for `!Send + !Sync` --- tests/no_send_sync.rs | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 tests/no_send_sync.rs diff --git a/tests/no_send_sync.rs b/tests/no_send_sync.rs new file mode 100644 index 00000000..3e41533e --- /dev/null +++ b/tests/no_send_sync.rs @@ -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; +} + +fn query(db: &impl NoSendDatabase, (): ()) -> Rc { + Rc::new(true) +} + +#[salsa::database(NoSendStorage)] +#[derive(Default)] +struct DatabaseImpl { + runtime: salsa::Runtime, +} + +impl salsa::Database for DatabaseImpl { + fn salsa_runtime(&self) -> &salsa::Runtime { + &self.runtime + } +} + +#[test] +fn no_send_sync() { + let mut db = DatabaseImpl::default(); + + db.query(()); +}