create a new section on pointer to reference conversion · patricklam/verify-rust-std@571348b

@@ -247,24 +247,7 @@ impl<T: ?Sized> *mut T {

247247

/// # Safety

248248

///

249249

/// When calling this method, you have to ensure that *either* the pointer is null *or*

250-

/// all of the following is true:

251-

///

252-

/// * The pointer must be properly aligned.

253-

///

254-

/// * It must be "dereferenceable" in the sense defined in [the module documentation].

255-

///

256-

/// * The pointer must point to an initialized instance of `T`.

257-

///

258-

/// * You must enforce Rust's aliasing rules, since the returned lifetime `'a` is

259-

/// arbitrarily chosen and does not necessarily reflect the actual lifetime of the data.

260-

/// In particular, while this reference exists, the memory the pointer points to must

261-

/// not get mutated (except inside `UnsafeCell`).

262-

///

263-

/// This applies even if the result of this method is unused!

264-

/// (The part about being initialized is not yet fully decided, but until

265-

/// it is, the only safe approach is to ensure that they are indeed initialized.)

266-

///

267-

/// [the module documentation]: crate::ptr#safety

250+

/// the pointer is [convirtible to a reference](crate::ptr#pointer-to-reference-conversion)

268251

///

269252

/// # Examples

270253

///

@@ -609,25 +592,10 @@ impl<T: ?Sized> *mut T {

609592

///

610593

/// # Safety

611594

///

612-

/// When calling this method, you have to ensure that *either* the pointer is null *or*

613-

/// all of the following is true:

614-

///

615-

/// * The pointer must be properly aligned.

616-

///

617-

/// * It must be "dereferenceable" in the sense defined in [the module documentation].

618-

///

619-

/// * The pointer must point to an initialized instance of `T`.

620-

///

621-

/// * You must enforce Rust's aliasing rules, since the returned lifetime `'a` is

622-

/// arbitrarily chosen and does not necessarily reflect the actual lifetime of the data.

623-

/// In particular, while this reference exists, the memory the pointer points to must

624-

/// not get accessed (read or written) through any other pointer.

595+

/// When calling this method, you have to ensure that *either*

596+

/// the pointer is null *or*

597+

/// the pointer is [convirtible to a reference](crate::ptr#pointer-to-reference-conversion)

625598

///

626-

/// This applies even if the result of this method is unused!

627-

/// (The part about being initialized is not yet fully decided, but until

628-

/// it is, the only safe approach is to ensure that they are indeed initialized.)

629-

///

630-

/// [the module documentation]: crate::ptr#safety

631599

///

632600

/// # Examples

633601

///