Weird error when passing guards to another thread
Ved-s opened this issue · comments
parking_lot's RwLockWriteGuard
implements Send
when the protected value implements it.
The error message with std
is nicer because it uses an unstable feature to directly implement !Send
on mutex guards. parking_lot
uses a different method (see GuardNoSend
) which effectively has the same effect.
what was the reason of doing that instead of !Send ?
impl !Send for Type {}
is unstable, so parking_lot can't use it. The standard library is privileged in that it can use any unstable feature even on stable rustc.
Makes sense, though I've seen parking_lot use impl !Sync (ig it's stable?)