Skip to content

Commit 0ba812f

Browse files
committed
rollup merge of #21706: reem/missing-zeroable-impl-for-unique
This allows the use of `NonZero<Unique<T>>` for owned, non-null raw pointers. cc Gankra/collect-rs#103
2 parents 692a366 + 83f8088 commit 0ba812f

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/libcore/nonzero.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,14 @@
1111
//! Exposes the NonZero lang item which provides optimization hints.
1212
1313
use ops::Deref;
14+
use ptr::Unique;
1415

1516
/// Unsafe trait to indicate what types are usable with the NonZero struct
1617
pub unsafe trait Zeroable {}
1718

1819
unsafe impl<T> Zeroable for *const T {}
1920
unsafe impl<T> Zeroable for *mut T {}
21+
unsafe impl<T> Zeroable for Unique<T> { }
2022
unsafe impl Zeroable for int {}
2123
unsafe impl Zeroable for uint {}
2224
unsafe impl Zeroable for i8 {}

0 commit comments

Comments
 (0)