]> Cypherpunks.ru repositories - gostls13.git/commit
slices: handle aliasing cases in Insert/Replace
authorKeith Randall <khr@golang.org>
Sat, 13 May 2023 03:23:57 +0000 (20:23 -0700)
committerKeith Randall <khr@golang.org>
Tue, 16 May 2023 23:34:50 +0000 (23:34 +0000)
commit882cc4d596ef179afecb920138419e694654589a
treef45af699f8cd5e2fe9e9029737a2a810e07eaef6
parent099f5a985f9db17c9d1048e6afb6fd162f41256c
slices: handle aliasing cases in Insert/Replace

Handle cases where the inserted slice is actually part of the slice
that is being inserted into.

Requires a bit more work, but no more allocations. (Compare to #494536.)

Not entirely sure this is worth the complication.

Fixes #60138

Change-Id: Ia72c872b04309b99025e6ca5a4a326ebed2abb69
Reviewed-on: https://go-review.googlesource.com/c/go/+/494817
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Keith Randall <khr@google.com>
Run-TryBot: Keith Randall <khr@golang.org>
Reviewed-by: Bryan Mills <bcmills@google.com>
src/go/build/deps_test.go
src/slices/slices.go
src/slices/slices_test.go