Skip to content

Commit 8dcf94e

Browse files
committed
reword
1 parent f3ed56d commit 8dcf94e

1 file changed

Lines changed: 13 additions & 8 deletions

File tree

library/std/src/keyword_docs.rs

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2042,14 +2042,19 @@ mod type_keyword {}
20422042
/// system.
20432043
///
20442044
/// The `unsafe` keyword has two uses:
2045-
/// - to declare the existence of contracts the compiler can't check (`unsafe fn` and `unsafe
2046-
/// trait`),
2047-
/// - and to declare that a programmer has checked that these contracts have been upheld (`unsafe
2048-
/// {}` and `unsafe impl`, but also sometimes `unsafe fn` -- see below).
2049-
///
2050-
/// Historically, these two are not mutually exclusive, as can be seen in `unsafe fn`: the body of
2051-
/// an `unsafe fn` is, on old editions, treated like an unsafe block. The `unsafe_op_in_unsafe_fn`
2052-
/// lint can be enabled to change that (and that lint is enabled by default since edition 2024).
2045+
/// - to declare the existence of contracts the compiler can't check,
2046+
/// - and to declare that a programmer has checked that these contracts have been upheld.
2047+
///
2048+
/// Typically, each `unsafe` is either of the first or second kind: `unsafe fn` and `unsafe trait`
2049+
/// declare the existence of an unsafe contract; `unsafe {}` and `unsafe impl` declare that an
2050+
/// unsafe contract (which must have been declared elsewhere) is being upheld.
2051+
///
2052+
/// However, historically, these two are not mutually exclusive: the body of an `unsafe fn` is, on
2053+
/// old editions, treated like an unsafe block, which means that this use of `unsafe` both declares
2054+
/// the existence of a contract to call the current function, and declares that the contracts of the
2055+
/// unsafe operations inside this function are being upheld. The `unsafe_op_in_unsafe_fn` lint can
2056+
/// be enabled to change that and make `unsafe fn` only play the former rule. That lint is enabled
2057+
/// by default since edition 2024.
20532058
///
20542059
/// # Unsafe abilities
20552060
///

0 commit comments

Comments
 (0)