Closed dzfranklin closed 3 years ago
I think my example would be improved by an example of a change that would make Carton Send but not Sync and neither Send nor Sync, but I can't think of any simples ones that don't violate the safety invarients of casting pointers.
Thank you everyone. I appreciate you all taking the time to point out my mistakes.
I have one question. I used rust,ignore because I got a build error that libc wasn't available and I'd otherwise a lot of hidden duplicate lines to make each example compile on its own. I saw a lot of other examples do the same. Is there a different solution I should do?
I have one question. I used rust,ignore because I got a build error that libc wasn't available and I'd otherwise a lot of hidden duplicate lines to make each example compile on its own. I saw a lot of other examples do the same. Is there a different solution I should do?
I'd like to avoid using rust,ignore
so that we can notice if it's stalled. And note that I don't put suggestions for the snippet that uses libc
but for the snippets that don't have any external deps. Indeed, we have a bunch of rust,ignore
snippets but I'm planning to re-evaluate and clean-up it once I get some time to it.
I believe all the issues are addressed.
I think this is ready @JohnTitor . Thank you everyone for helping me fix my code!
Thanks for catching those issues. All fixed.
Thanks again for the great work!
Thank you for holding my hand so much! I've learned a lot.
Add an example of thinking through whether it is sound to implement Send + Sync for a custom type that wraps a raw pointer.
I read the existing docs and was confused about whether I could implement Send + Sync for a type I wrote that wraps a c-style array. Kixiron, InfernoDeity, Talchas, and HeroicKatora on #black-magic helped me understand Send and Sync better. This example is based on the advice they gave me. I've made lots of changes, so any errors are probably mine.