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:
commit
0ba812fbf0
@ -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 {}
|
||||
|
Loading…
Reference in New Issue
Block a user