Implement Send
/Sync
for CopyTaggedPtr
This commit is contained in:
parent
dc19dc29c9
commit
c155d5149f
1 changed files with 20 additions and 0 deletions
|
@ -253,6 +253,26 @@ where
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Safety:
|
||||||
|
// `CopyTaggedPtr<P, T, ..>` is semantically just `{ ptr: P, tag: T }`, as such
|
||||||
|
// it's ok to implement `Sync` as long as `P: Sync, T: Sync`
|
||||||
|
unsafe impl<P, T, const CP: bool> Sync for CopyTaggedPtr<P, T, CP>
|
||||||
|
where
|
||||||
|
P: Sync + Pointer,
|
||||||
|
T: Sync + Tag,
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
// Safety:
|
||||||
|
// `CopyTaggedPtr<P, T, ..>` is semantically just `{ ptr: P, tag: T }`, as such
|
||||||
|
// it's ok to implement `Send` as long as `P: Send, T: Send`
|
||||||
|
unsafe impl<P, T, const CP: bool> Send for CopyTaggedPtr<P, T, CP>
|
||||||
|
where
|
||||||
|
P: Send + Pointer,
|
||||||
|
T: Send + Tag,
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
/// Test that `new` does not compile if there is not enough alignment for the
|
/// Test that `new` does not compile if there is not enough alignment for the
|
||||||
/// tag in the pointer.
|
/// tag in the pointer.
|
||||||
///
|
///
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue