You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently RwLockReadGuard is invariant over its type parameter, meaning that for instance this sound code:
use parking_lot::{RwLock,RwLockReadGuard};fndo_stuff<'a>(_:RwLockReadGuard<'_,&'a i32>, _:&'a i32){}fnmain(){let j:i32 = 5;let lock = RwLock::new(&j);{let i = 6;do_stuff(lock.read(),&i);}drop(lock);}
Will not compile. However, since RwLockReadGuard does not allow for mutation of the inner value, it would be sound to make it covariant, and it would be useful in some circumstances.
Currently
RwLockReadGuard
is invariant over its type parameter, meaning that for instance this sound code:Will not compile. However, since
RwLockReadGuard
does not allow for mutation of the inner value, it would be sound to make it covariant, and it would be useful in some circumstances.See also the same issue in std.
The text was updated successfully, but these errors were encountered: