1 // expected: a subslice is a copy, so a write through it is not allowed
2 //
3 // Moxie subslicing is ALWAYS a copy: x[1:3] is a new slice holding those two
4 // elements, and it has no address of its own. A store through it therefore
5 // writes into a throwaway that occupies arena space and leaves the original
6 // untouched, which is never what the source meant. The rewrite is resize(p, n)
7 // to move the start of the slice and push(p, v) to write the value.
8 package main
9 10 func main() {
11 xs := []byte{1, 2, 3, 4}
12 xs[1:3][0] = 9
13 println(xs[0])
14 }
15