@@ -465,7 +465,7 @@ impl<T: ?Sized> PartialOrd for *mut T {
465
465
fn ge ( & self , other : & * mut T ) -> bool { * self >= * other }
466
466
}
467
467
468
- /// A wrapper around a raw `*mut T` that indicates that the possessor
468
+ /// A wrapper around a raw non-null `*mut T` that indicates that the possessor
469
469
/// of this wrapper owns the referent. This in turn implies that the
470
470
/// `Unique<T>` is `Send`/`Sync` if `T` is `Send`/`Sync`, unlike a raw
471
471
/// `*mut T` (which conveys no particular ownership semantics). It
@@ -502,6 +502,10 @@ unsafe impl<T: Sync + ?Sized> Sync for Unique<T> { }
502
502
#[ unstable( feature = "unique" , issue = "27730" ) ]
503
503
impl < T : ?Sized > Unique < T > {
504
504
/// Creates a new `Unique`.
505
+ ///
506
+ /// # Safety
507
+ ///
508
+ /// `ptr` must be non-null.
505
509
pub const unsafe fn new ( ptr : * mut T ) -> Unique < T > {
506
510
Unique { pointer : NonZero :: new ( ptr) , _marker : PhantomData }
507
511
}
@@ -537,7 +541,7 @@ impl<T> fmt::Pointer for Unique<T> {
537
541
}
538
542
}
539
543
540
- /// A wrapper around a raw `*mut T` that indicates that the possessor
544
+ /// A wrapper around a raw non-null `*mut T` that indicates that the possessor
541
545
/// of this wrapper has shared ownership of the referent. Useful for
542
546
/// building abstractions like `Rc<T>` or `Arc<T>`, which internally
543
547
/// use raw pointers to manage the memory that they own.
@@ -566,6 +570,10 @@ impl<T: ?Sized> !Sync for Shared<T> { }
566
570
#[ unstable( feature = "shared" , issue = "27730" ) ]
567
571
impl < T : ?Sized > Shared < T > {
568
572
/// Creates a new `Shared`.
573
+ ///
574
+ /// # Safety
575
+ ///
576
+ /// `ptr` must be non-null.
569
577
pub unsafe fn new ( ptr : * mut T ) -> Self {
570
578
Shared { pointer : NonZero :: new ( ptr) , _marker : PhantomData }
571
579
}
0 commit comments