mirror of
https://github.com/salsa-rs/salsa.git
synced 2025-08-04 11:00:05 +00:00
convert DatabaseSlot
to unsafe trait
The unsafe impl now asserts that the `DatabaseSlot` implementor type is indeed `Send+Sync` if `DB::DatabaseData` is `Send+Sync`. Since our query keys/values are a part of database-data, this means that `Slot` must be `Send+Sync` if the key/value are `Send+Sync`. We test this with a function that will cause compliation to fail if we accidentally introduce an `Rc<T>` etc.
This commit is contained in:
parent
579e093213
commit
e7d704dd8b
8 changed files with 250 additions and 9 deletions
|
@ -367,7 +367,9 @@ pub(crate) fn query_group(args: TokenStream, input: TokenStream) -> TokenStream
|
|||
#[derive(Default, Debug)]
|
||||
#trait_vis struct #qt;
|
||||
|
||||
impl<#db> salsa::Query<#db> for #qt
|
||||
// Unsafe proof obligation: that our key/value are a part
|
||||
// of the `GroupData`.
|
||||
unsafe impl<#db> salsa::Query<#db> for #qt
|
||||
where
|
||||
DB: #trait_name + #requires,
|
||||
DB: salsa::plumbing::HasQueryGroup<#group_struct>,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue