diff options
author | Keith Randall <khr@golang.org> | 2021-05-09 11:06:17 -0700 |
---|---|---|
committer | Keith Randall <khr@golang.org> | 2021-05-10 13:16:56 +0000 |
commit | 287025925f66f90ad9b30aea2e533928026a8376 (patch) | |
tree | d1d08af3e2dbb39ee461a3d9bc821b406e6a384b /src/reflect/all_test.go | |
parent | c14ecaca8182314efd2ef7280feffc2242644887 (diff) | |
download | go-287025925f66f90ad9b30aea2e533928026a8376.tar.gz go-287025925f66f90ad9b30aea2e533928026a8376.zip |
cmd/compile,reflect: allow longer type names
Encode the length of type names and tags in a varint encoding
instead of a fixed 2-byte encoding. This allows lengths longer
than 65535 (which can happen for large unnamed structs).
Removed the alignment check for #14962, it isn't relevant any more
since we're no longer reading pointers directly out of this data
(it is encoded as an offset which is copied out bytewise).
Fixes #44155
Update #14962
Change-Id: I6084f6027e5955dc16777c87b0dd5ea2baa49629
Reviewed-on: https://go-review.googlesource.com/c/go/+/318249
Trust: Keith Randall <khr@golang.org>
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Diffstat (limited to 'src/reflect/all_test.go')
-rw-r--r-- | src/reflect/all_test.go | 13 |
1 files changed, 0 insertions, 13 deletions
diff --git a/src/reflect/all_test.go b/src/reflect/all_test.go index 065ff04611..17104ad4fa 100644 --- a/src/reflect/all_test.go +++ b/src/reflect/all_test.go @@ -6942,19 +6942,6 @@ func TestExported(t *testing.T) { } } -type embed struct { - EmbedWithUnexpMeth -} - -func TestNameBytesAreAligned(t *testing.T) { - typ := TypeOf(embed{}) - b := FirstMethodNameBytes(typ) - v := uintptr(unsafe.Pointer(b)) - if v%unsafe.Alignof((*byte)(nil)) != 0 { - t.Errorf("reflect.name.bytes pointer is not aligned: %x", v) - } -} - func TestTypeStrings(t *testing.T) { type stringTest struct { typ Type |