Rewrite Unique<T> so that it is covariant in T, implies NonZero and ownership,
and also follows the API of `NonZero` a bit more closely. More to do here I think (including perhaps a new name).
This commit is contained in:
@@ -171,8 +171,8 @@ fn test_set_memory() {
|
||||
#[test]
|
||||
fn test_unsized_unique() {
|
||||
let xs: &mut [_] = &mut [1, 2, 3];
|
||||
let ptr = Unique(xs as *mut [_]);
|
||||
let ys = unsafe { &mut *ptr.ptr };
|
||||
let ptr = unsafe { Unique::new(xs as *mut [_]) };
|
||||
let ys = unsafe { &mut **ptr };
|
||||
let zs: &mut [_] = &mut [1, 2, 3];
|
||||
assert!(ys == zs);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user