// expected: a subslice is a copy, so copying into it is not allowed // // copy's destination is a write, and a subslice is a copy, so copy(x[a:b], src) // fills a throwaway that occupies arena space and leaves x untouched. The same // rule as an assignment through a subslice; the fix is to write the elements or // resize the slice. copy(x[1], src) is addressing an element, not subslicing, // and is untouched by this rule. package main func main() { xs := []byte{1, 2, 3, 4} copy(xs[1:3], []byte{9, 9}) println(xs[1]) }