4 ms·
You don't need to implement Send for POD types – it is automatically implemented. Almost all types implement Send. There are only a few exceptions that I know o
by GolDDranks 8y ago
You don't need to implement Send for POD types – it is automatically implemented. Almost all types implement Send. There are only a few exceptions that I know of: Rc (the non-atomic reference counted pointer) doesn't implement Send because it doesn't support atomically updating the count. Also raw pointers don't implement Send.
- brian-armstrong 8y agoThe fact that we’re even having this conversation, caused by compiler error ambiguity, demonstrates my point about ergonomics nicely :)
- steveklabnik 8y agoPlease file bugs if the errors are confusing!
- brian-armstrong 8y agoEh, they’re probably fine for regular users. They are just nonsensical when you’re starting out.
- steveklabnik 8y agoWe care just as much for people just starting out as we do for regular users; possibly even more!
- huhlig 8y agoIf you want compiler ambiguity in C++ look no further than Templates... C++ is rarely ergonomic to use.
- psyclobe 8y agoI like templates, because to date there is not a popular language that can do compile time stuff it can do. And no joke, some of the stuff you can do is quite amazing.
- chi3 8y agoWell, there's plenty to say about C++ compiler errors too!
- brian-armstrong 8y agoClang has done a really amazing job of cleaning those up. I find them super helpful these days.
- Manishearth 8y agoGiven that Send is autoimplemented for things that should be Send, this is a strong indication towards your code attempting to send actually not-thread-safe things across threads (things containing borrowed references or Rc<T>) The error message does drill down and tell you the actual type causing the lack of Send impl. The only time you have to manually impl Send is for custom container types that are built from raw primitives.