mirror of
https://github.com/danbulant/oxc
synced 2026-05-24 12:21:58 +00:00
feat(allocator): add Send + Sync to HashMap
This commit is contained in:
parent
6c4081e148
commit
3d64cefe10
1 changed files with 5 additions and 0 deletions
|
|
@ -50,6 +50,11 @@ type FxHashMap<'alloc, K, V> = hashbrown::HashMap<K, V, FxBuildHasher, &'alloc B
|
|||
/// [`FxHasher`]: rustc_hash::FxHasher
|
||||
pub struct HashMap<'alloc, K, V>(ManuallyDrop<FxHashMap<'alloc, K, V>>);
|
||||
|
||||
/// SAFETY: Not actually safe, but for enabling `Send` for downstream crates.
|
||||
unsafe impl<K, V> Send for HashMap<'_, K, V> {}
|
||||
/// SAFETY: Not actually safe, but for enabling `Sync` for downstream crates.
|
||||
unsafe impl<K, V> Sync for HashMap<'_, K, V> {}
|
||||
|
||||
// TODO: `IntoIter`, `Drain`, and other consuming iterators provided by `hashbrown` are `Drop`.
|
||||
// Wrap them in `ManuallyDrop` to prevent that.
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue