review feedback
This commit is contained in:
parent
595e192274
commit
c30dcff97a
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user