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
/// # #![allow(dead_code)]
/// #![deny(unsafe_op_in_unsafe_fn)]
///
/// /// Dereference the given pointer.
/// ///
/// /// # 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
/// its callers must uphold -- the fact that `idx < LEN`.
///
/// Formally speaking, an `unsafe fn` in a trait is a function with extra
/// *preconditions* (such as `idx < LEN`), whereas an `unsafe trait` can declare
/// that some of its functions have extra *postconditions* (such as returning an
/// even integer). If a trait needs a function with both extra precondition and
/// extra postcondition, then it needs an `unsafe fn` in an `unsafe trait`.
/// Formally speaking, an `unsafe fn` in a trait is a function with *preconditions* that go beyond
/// those encoded by the argument types (such as `idx < LEN`), whereas an `unsafe trait` can declare
/// that some of its functions have *postconditions* that go beyond those encoded in the return type
/// (such as returning an even integer). If a trait needs a function with both extra precondition
/// and extra postcondition, then it needs an `unsafe fn` in an `unsafe trait`.
///
/// [`extern`]: keyword.extern.html
/// [`trait`]: keyword.trait.html