docs: fix notice for the doc samples, turn a[1..4] to unsafe { a[1..4] } (fix #19249) (#19254)

This commit is contained in:
Adam Oates 2023-09-01 02:08:47 -05:00 committed by GitHub
parent fca8092523
commit 448f60422a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1231,7 +1231,7 @@ The behaviour depends on the parent's capacity and is predictable:
```v ```v
mut a := []int{len: 5, cap: 6, init: 2} mut a := []int{len: 5, cap: 6, init: 2}
mut b := a[1..4] mut b := unsafe { a[1..4] }
a << 3 a << 3
// no reallocation - fits in `cap` // no reallocation - fits in `cap`
b[2] = 13 // `a[3]` is modified b[2] = 13 // `a[3]` is modified