From 83f8088108053efd2079d8ba8d677577685e8f6f Mon Sep 17 00:00:00 2001 From: Jonathan Reem Date: Tue, 27 Jan 2015 18:17:04 -0500 Subject: [PATCH] Add an implementation of Zeroable for Unique This allows the use of `NonZero>` for owned, non-null raw pointers. cc https://github.com/Gankro/collect-rs/pull/103 --- src/libcore/nonzero.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/libcore/nonzero.rs b/src/libcore/nonzero.rs index abaf2529323..53c866c39dd 100644 --- a/src/libcore/nonzero.rs +++ b/src/libcore/nonzero.rs @@ -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 Zeroable for *const T {} unsafe impl Zeroable for *mut T {} +unsafe impl Zeroable for Unique { } unsafe impl Zeroable for int {} unsafe impl Zeroable for uint {} unsafe impl Zeroable for i8 {}