Closed CosmicHorrorDev closed 1 year ago
Thanks for the fix and thanks for spotting this! I copied this from Arc, but was apparently a bit too trigger-happy with my multi-cursor delete of the ?Sized
bounds and stability attributes. But these kinds of things are exactly why I posted on reddit and waited with publishing to crates.io.
Also, miri is absolutely awesome!
Also, miri is absolutely awesome!
Can't be more true!
Last PR I can do for the day (got a lot of IRL stuff today), but it's another soundness fix
This fixes
EcoVec
'sSend
andSync
bounds to match the standard library'sArc
Arc
-like constructs need bothSend
andSync
on the inner type to allow forSend
orSync
. Without this it's trivial to violate the inner type's boundE.g. a type can be
Send + !Sync
, but that would allow you to create twoArc
s on the same thread and then pass one of theArc
s to another thread. From there you have a reference to the type from multiple threads even though it's!Sync
. A simple example program that makesmiri
angryFor even more fun you can change one of the strings that get swapped to something really big and then you can get fun runtime issues.
(Being totally honest I'm just having fun seeing what wacky stuff can happen with Rust's UB. Sometimes I miss how cursed C programming can be)