go version devel go1.24-140308837f Mon Oct 21 15:30:47 2024 +0200 darwin/arm64
The return value of copy is guaranteed to be <= len(x) for x being both the arguments, so the following function shouldn't have bounds checks.
func foo(a, b []byte) {
n := copy(a, b)
_ = a[n:] // bounds check!
_ = b[n:] // bounds check!
}
The return value of copy is guaranteed to be
<= len(x)for x being both the arguments, so the following function shouldn't have bounds checks.