chore: add safety comments on unsafe blocks (#827)

This commit is contained in:
vip892766gma
2026-05-19 13:11:51 -04:00
committed by GitHub
parent 245adff079
commit 2256e6dc3e
3 changed files with 71 additions and 0 deletions
+4
View File
@@ -489,6 +489,8 @@ impl Bytes {
self.len = at;
// SAFETY: `at` has been asserted to be <= `self.len()`, and the
// `at == self.len()` and `at == 0` cases were handled above.
unsafe { ret.inc_start(at) };
ret
@@ -537,6 +539,8 @@ impl Bytes {
let mut ret = self.clone();
// SAFETY: `at` has been asserted to be <= `self.len()`, and the
// `at == self.len()` and `at == 0` cases were handled above.
unsafe { self.inc_start(at) };
ret.len = at;