From db16de920370892b0241d3fa0617dddff2417a4d Mon Sep 17 00:00:00 2001 From: Keith Randall Date: Mon, 25 Mar 2019 12:34:27 -0700 Subject: runtime: remove kindNoPointers We already have the ptrdata field in a type, which encodes exactly the same information that kindNoPointers does. My problem with kindNoPointers is that it often leads to double-negative code like: t.kind & kindNoPointers != 0 Much clearer is: t.ptrdata == 0 Update #27167 Change-Id: I92307d7f018a6bbe3daca4a4abb4225e359349b1 Reviewed-on: https://go-review.googlesource.com/c/go/+/169157 Run-TryBot: Keith Randall TryBot-Result: Gobot Gobot Reviewed-by: Brad Fitzpatrick --- src/runtime/slice.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/runtime/slice.go') diff --git a/src/runtime/slice.go b/src/runtime/slice.go index dca41ff8cd..79cfc69c54 100644 --- a/src/runtime/slice.go +++ b/src/runtime/slice.go @@ -171,7 +171,7 @@ func growslice(et *_type, old slice, cap int) slice { } var p unsafe.Pointer - if et.kind&kindNoPointers != 0 { + if et.ptrdata == 0 { p = mallocgc(capmem, nil, false) // The append() that calls growslice is going to overwrite from old.len to cap (which will be the new length). // Only clear the part that will not be overwritten. -- cgit v1.3-5-g45d5