review feedback

This commit is contained in:
Ralf Jung 2022-10-07 15:21:47 +02:00
parent 595e192274
commit c30dcff97a

View File

@ -1992,6 +1992,7 @@ mod type_keyword {}
/// ```rust /// ```rust
/// # #![allow(dead_code)] /// # #![allow(dead_code)]
/// #![deny(unsafe_op_in_unsafe_fn)] /// #![deny(unsafe_op_in_unsafe_fn)]
///
/// /// Dereference the given pointer. /// /// Dereference the given pointer.
/// /// /// ///
/// /// # Safety /// /// # Safety
@ -2115,11 +2116,11 @@ mod type_keyword {}
/// is not implicitly an unsafe block.) For that purpose it can make use of the contract that all /// is not implicitly an unsafe block.) For that purpose it can make use of the contract that all
/// its callers must uphold -- the fact that `idx < LEN`. /// its callers must uphold -- the fact that `idx < LEN`.
/// ///
/// Formally speaking, an `unsafe fn` in a trait is a function with extra /// Formally speaking, an `unsafe fn` in a trait is a function with *preconditions* that go beyond
/// *preconditions* (such as `idx < LEN`), whereas an `unsafe trait` can declare /// those encoded by the argument types (such as `idx < LEN`), whereas an `unsafe trait` can declare
/// that some of its functions have extra *postconditions* (such as returning an /// that some of its functions have *postconditions* that go beyond those encoded in the return type
/// even integer). If a trait needs a function with both extra precondition and /// (such as returning an even integer). If a trait needs a function with both extra precondition
/// extra postcondition, then it needs an `unsafe fn` in an `unsafe trait`. /// and extra postcondition, then it needs an `unsafe fn` in an `unsafe trait`.
/// ///
/// [`extern`]: keyword.extern.html /// [`extern`]: keyword.extern.html
/// [`trait`]: keyword.trait.html /// [`trait`]: keyword.trait.html