-
Notifications
You must be signed in to change notification settings - Fork 321
Closed
Description
It seems like hashbrown structures doesn't implement Send making it very hard to use them in multithreaded applications
For example, attempt to return them from thread via join handle:
extern crate hashbrown;
fn main () {
std::thread::spawn(move || { hashbrown::HashSet::new() } );
std::thread::spawn(move || { hashbrown::HashMap::new() } );
}
Wouldn't compile
➜ cargo build
error[E0277]: `std::ptr::NonNull<u8>` cannot be sent between threads safely
--> src/main.rs:4:5
|
4 | std::thread::spawn(move || { hashbrown::HashSet::new() } );
| ^^^^^^^^^^^^^^^^^^ `std::ptr::NonNull<u8>` cannot be sent between threads safely
|
= help: within `hashbrown::HashSet<_>`, the trait `std::marker::Send` is not implemented for `std::ptr::NonNull<u8>`
= note: required because it appears within the type `hashbrown::raw::RawTable<(_, ())>`
= note: required because it appears within the type `hashbrown::HashMap<_, ()>`
= note: required because it appears within the type `hashbrown::HashSet<_>`
= note: required by `std::thread::spawn`
error[E0277]: `std::ptr::NonNull<(_, ())>` cannot be sent between threads safely
--> src/main.rs:4:5
|
4 | std::thread::spawn(move || { hashbrown::HashSet::new() } );
| ^^^^^^^^^^^^^^^^^^ `std::ptr::NonNull<(_, ())>` cannot be sent between threads safely
|
= help: within `hashbrown::HashSet<_>`, the trait `std::marker::Send` is not implemented for `std::ptr::NonNull<(_, ())>`
= note: required because it appears within the type `hashbrown::raw::RawTable<(_, ())>`
.....
anna-is-cute and Xaeroxe
Metadata
Metadata
Assignees
Labels
No labels