]> git.lizzy.rs Git - rust.git/commitdiff
Add an implementation of Zeroable for Unique<T>
authorJonathan Reem <jonathan.reem@gmail.com>
Tue, 27 Jan 2015 23:17:04 +0000 (18:17 -0500)
committerJonathan Reem <jonathan.reem@gmail.com>
Tue, 27 Jan 2015 23:17:04 +0000 (18:17 -0500)
This allows the use of `NonZero<Unique<T>>` for owned,
non-null raw pointers.

cc https://github.com/Gankro/collect-rs/pull/103

src/libcore/nonzero.rs

index abaf252932300a0023a77ac665c6fb3ca080da9b..53c866c39dd14c86341edb3ea0f3430b1488354b 100644 (file)
 //! 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 {}