mirror of
https://github.com/golang/go.git
synced 2025-05-31 23:25:39 +00:00
bytes: simplify code using unsafe.SliceData
Updates #54854 Change-Id: I9c14f9fa595f73eae44eb714abc5d486915893c1 Reviewed-on: https://go-review.googlesource.com/c/go/+/428155 Reviewed-by: Ian Lance Taylor <iant@google.com> Reviewed-by: Bryan Mills <bcmills@google.com> Run-TryBot: Ian Lance Taylor <iant@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Auto-Submit: Ian Lance Taylor <iant@google.com>
This commit is contained in:
parent
502504f433
commit
2a627afe13
@ -2186,9 +2186,7 @@ func TestClone(t *testing.T) {
|
||||
t.Errorf("Clone(%#v) return value should not be equal to nil slice.", input)
|
||||
}
|
||||
|
||||
inputHeader := (*reflect.SliceHeader)(unsafe.Pointer(&input))
|
||||
cloneHeader := (*reflect.SliceHeader)(unsafe.Pointer(&clone))
|
||||
if cap(input) != 0 && cloneHeader.Data == inputHeader.Data {
|
||||
if cap(input) != 0 && unsafe.SliceData(input) == unsafe.SliceData(clone) {
|
||||
t.Errorf("Clone(%q) return value should not reference inputs backing memory.", input)
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user