Skip to content

Commit 2f7b05f

Browse files
authored
Merge pull request #50 from SimonSapin/patch-2
Clarify "unsafe pollutes the module"
2 parents 7dfcd07 + 79d7569 commit 2f7b05f

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/working-with-unsafe.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,8 @@ capacity violates the invariants of Vec (that `cap` reflects the allocated space
9292
in the Vec). This is not something the rest of Vec can guard against. It *has*
9393
to trust the capacity field because there's no way to verify it.
9494

95-
`unsafe` does more than pollute a whole function: it pollutes a whole *module*.
95+
Because it relies on invariants of a struct field, this `unsafe` code
96+
does more than pollute a whole function: it pollutes a whole *module*.
9697
Generally, the only bullet-proof way to limit the scope of unsafe code is at the
9798
module boundary with privacy.
9899

0 commit comments

Comments
 (0)