Skip to content

Commit 3c3c084

Browse files
gregschmitRalfJung
andcommitted
Clarify which proof obligations are referenced.
Co-authored-by: Ralf Jung <[email protected]>
1 parent 1ea0178 commit 3c3c084

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/unsafe-keyword.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@ this can be changed by enabling the [`unsafe_op_in_unsafe_fn`] lint.
2727
By putting operations into an unsafe block, the programmer states that they have taken care of satisfying the extra safety conditions of all operations inside that block.
2828

2929
Unsafe blocks are the logical dual to unsafe functions:
30-
where unsafe functions define a proof obligation that callers must uphold, unsafe blocks state that all relevant proof obligations have been discharged.
30+
where unsafe functions define a proof obligation that callers must uphold, unsafe blocks state that all relevant proof obligations of functions or operations called inside the block have been discharged.
3131
There are many ways to discharge proof obligations;
32-
for example, there could be run-time checks or data structure invariants that guarantee that certain properties are definitely true, or the unsafe block could be inside an `unsafe fn` and use its own proof obligations to discharge the proof obligations of its callees.
32+
for example, there could be run-time checks or data structure invariants that guarantee that certain properties are definitely true, or the unsafe block could be inside an `unsafe fn`, in which case the block can use the proof obligations of that function to discharge the proof obligations of any unsafe functions called inside the block.
3333

3434
Unsafe blocks are used to wrap foreign libraries, make direct use of hardware or implement features not directly present in the language.
3535
For example, Rust provides the language features necessary to implement memory-safe concurrency in the language but the implementation of threads and message passing in the standard library uses unsafe blocks.

0 commit comments

Comments
 (0)