Open rbtcollins opened 1 month ago
The error comes from Sacl
and Dacl
in SECURITY_DESCRIPTOR in OpenOptionsImpl on Windows. As Send and Sync are marker traits, this struct can never be safe to Send / Sync.
https://docs.rs/wnf/latest/src/wnf/security.rs.html#31-33 is an implementation that uses an opaque type; but this should still have Sacl and Dacl used by Windows, so it seems likely that an appropriate parsable descriptor could end up with cross-thread access through a pointer.
Clone is not implemented on SECURITY_DESCRIPTOR either.
Possibly switching to an external type and hoping would make sense.
Alternatively, making the OpenOptions methods consume the struct, or moving the non Send/Sync things to an Arc<Option
And perhaps more generally, some tokio glue would be nice. For File, tokio has a From implementation, but (somewhat obviously) no integration for these _at functions.
One path would be implement that here with a feature. Another would be to just make sure the types are friendly for doing that
when doing a naive shim layer, got this error