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 https://github.com/Gankro/collect-rs/pull/103
This commit is contained in:
Alex Crichton 2015-01-30 12:03:19 -08:00
commit 0ba812fbf0
1 changed files with 2 additions and 0 deletions

View File

@ -11,12 +11,14 @@
//! Exposes the NonZero lang item which provides optimization hints.
use ops::Deref;
use ptr::Unique;
/// Unsafe trait to indicate what types are usable with the NonZero struct
pub unsafe trait Zeroable {}
unsafe impl<T> Zeroable for *const T {}
unsafe impl<T> Zeroable for *mut T {}
unsafe impl<T> Zeroable for Unique<T> { }
unsafe impl Zeroable for int {}
unsafe impl Zeroable for uint {}
unsafe impl Zeroable for i8 {}