@@ -296,24 +296,7 @@ impl<T: ?Sized> *mut T {
296
296
///
297
297
/// # Safety
298
298
///
299
- /// When calling this method, you have to ensure that all of the following is true:
300
- ///
301
- /// * The pointer must be properly aligned.
302
- ///
303
- /// * It must be "dereferenceable" in the sense defined in [the module documentation].
304
- ///
305
- /// * The pointer must point to an initialized instance of `T`.
306
- ///
307
- /// * You must enforce Rust's aliasing rules, since the returned lifetime `'a` is
308
- /// arbitrarily chosen and does not necessarily reflect the actual lifetime of the data.
309
- /// In particular, while this reference exists, the memory the pointer points to must
310
- /// not get mutated (except inside `UnsafeCell`).
311
- ///
312
- /// This applies even if the result of this method is unused!
313
- /// (The part about being initialized is not yet fully decided, but until
314
- /// it is, the only safe approach is to ensure that they are indeed initialized.)
315
- ///
316
- /// [the module documentation]: crate::ptr#safety
299
+ /// When calling this method, you have to ensure that the pointer is [convirtible to a reference](crate::ptr#pointer-to-reference-conversion)
317
300
///
318
301
/// # Examples
319
302
///
@@ -347,20 +330,9 @@ impl<T: ?Sized> *mut T {
347
330
/// # Safety
348
331
///
349
332
/// When calling this method, you have to ensure that *either* the pointer is null *or*
350
- /// all of the following is true:
351
- ///
352
- /// * The pointer must be properly aligned.
353
- ///
354
- /// * It must be "dereferenceable" in the sense defined in [the module documentation].
355
- ///
356
- /// * You must enforce Rust's aliasing rules, since the returned lifetime `'a` is
357
- /// arbitrarily chosen and does not necessarily reflect the actual lifetime of the data.
358
- /// In particular, while this reference exists, the memory the pointer points to must
359
- /// not get mutated (except inside `UnsafeCell`).
360
- ///
361
- /// This applies even if the result of this method is unused!
362
- ///
363
- /// [the module documentation]: crate::ptr#safety
333
+ /// the pointer is [convirtible to a reference](crate::ptr#pointer-to-reference-conversion).
334
+ /// Note that because the created reference is to `MaybeUninit<T>`, the
335
+ /// source pointer can point to uninitialized memory.
364
336
///
365
337
/// # Examples
366
338
///
@@ -594,7 +566,7 @@ impl<T: ?Sized> *mut T {
594
566
///
595
567
/// When calling this method, you have to ensure that *either*
596
568
/// the pointer is null *or*
597
- /// the pointer is [convirtible to a reference](crate::ptr#pointer-to-reference-conversion)
569
+ /// the pointer is [convertible to a reference](crate::ptr#pointer-to-reference-conversion)
598
570
///
599
571
///
600
572
/// # Examples
@@ -643,24 +615,8 @@ impl<T: ?Sized> *mut T {
643
615
///
644
616
/// # Safety
645
617
///
646
- /// When calling this method, you have to ensure that all of the following is true:
647
- ///
648
- /// * The pointer must be properly aligned.
649
- ///
650
- /// * It must be "dereferenceable" in the sense defined in [the module documentation].
651
- ///
652
- /// * The pointer must point to an initialized instance of `T`.
653
- ///
654
- /// * You must enforce Rust's aliasing rules, since the returned lifetime `'a` is
655
- /// arbitrarily chosen and does not necessarily reflect the actual lifetime of the data.
656
- /// In particular, while this reference exists, the memory the pointer points to must
657
- /// not get mutated (except inside `UnsafeCell`).
658
- ///
659
- /// This applies even if the result of this method is unused!
660
- /// (The part about being initialized is not yet fully decided, but until
661
- /// it is, the only safe approach is to ensure that they are indeed initialized.)
662
- ///
663
- /// [the module documentation]: crate::ptr#safety
618
+ /// When calling this method, you have to ensure that
619
+ /// the pointer is [convertible to a reference](crate::ptr#pointer-to-reference-conversion)
664
620
///
665
621
/// # Examples
666
622
///
@@ -695,20 +651,7 @@ impl<T: ?Sized> *mut T {
695
651
/// # Safety
696
652
///
697
653
/// When calling this method, you have to ensure that *either* the pointer is null *or*
698
- /// all of the following is true:
699
- ///
700
- /// * The pointer must be properly aligned.
701
- ///
702
- /// * It must be "dereferenceable" in the sense defined in [the module documentation].
703
- ///
704
- /// * You must enforce Rust's aliasing rules, since the returned lifetime `'a` is
705
- /// arbitrarily chosen and does not necessarily reflect the actual lifetime of the data.
706
- /// In particular, while this reference exists, the memory the pointer points to must
707
- /// not get accessed (read or written) through any other pointer.
708
- ///
709
- /// This applies even if the result of this method is unused!
710
- ///
711
- /// [the module documentation]: crate::ptr#safety
654
+ /// the pointer is [convertible to a reference](crate::ptr#pointer-to-reference-conversion)
712
655
#[ inline]
713
656
#[ unstable( feature = "ptr_as_uninit" , issue = "75402" ) ]
714
657
#[ rustc_const_unstable( feature = "const_ptr_as_ref" , issue = "91822" ) ]
0 commit comments