File tree Expand file tree Collapse file tree 5 files changed +24
-16
lines changed Expand file tree Collapse file tree 5 files changed +24
-16
lines changed Original file line number Diff line number Diff line change @@ -1686,12 +1686,6 @@ type funcHeader struct {
16861686 Code unsafe.Pointer
16871687}
16881688
1689- type SliceHeader struct {
1690- Data uintptr
1691- Len intw
1692- Cap intw
1693- }
1694-
16951689// Slice header that matches the underlying structure. Used for when we switch
16961690// to a precise GC, which needs to know exactly where pointers live.
16971691type sliceHeader struct {
@@ -1700,11 +1694,6 @@ type sliceHeader struct {
17001694 cap uintptr
17011695}
17021696
1703- type StringHeader struct {
1704- Data uintptr
1705- Len intw
1706- }
1707-
17081697// Like sliceHeader, this type is used internally to make sure pointer and
17091698// non-pointer fields match those of actual strings.
17101699type stringHeader struct {
@@ -1716,9 +1705,7 @@ type stringHeader struct {
17161705// See https://github.com/tinygo-org/tinygo/pull/4156
17171706// and https://github.com/tinygo-org/tinygo/issues/1284.
17181707var (
1719- _ [unsafe .Sizeof ([]byte {})]byte = [unsafe .Sizeof (SliceHeader {})]byte {}
17201708 _ [unsafe .Sizeof ([]byte {})]byte = [unsafe .Sizeof (sliceHeader {})]byte {}
1721- _ [unsafe .Sizeof ("" )]byte = [unsafe .Sizeof (StringHeader {})]byte {}
17221709 _ [unsafe .Sizeof ("" )]byte = [unsafe .Sizeof (stringHeader {})]byte {}
17231710)
17241711
Original file line number Diff line number Diff line change 11//go:build !avr
22
3- package reflectlite
3+ package reflect
44
55// intw is an integer type, used in places where an int is typically required,
66// except architectures where the size of an int != word size.
Original file line number Diff line number Diff line change 11//go:build avr
22
3- package reflectlite
3+ package reflect
44
55// intw is an integer type, used in places where an int is typically required,
66// except architectures where the size of an int != word size.
Original file line number Diff line number Diff line change 11//go:build !avr
22
3- package reflectlite_test
3+ package reflect_test
44
55import (
66 "reflect"
Original file line number Diff line number Diff line change @@ -226,3 +226,24 @@ func (v Value) Recv() (x Value, ok bool) {
226226func NewAt (typ Type , p unsafe.Pointer ) Value {
227227 panic ("unimplemented: reflect.New()" )
228228}
229+
230+ // Deprecated: Use unsafe.Slice or unsafe.SliceData instead.
231+ type SliceHeader struct {
232+ Data uintptr
233+ Len intw
234+ Cap intw
235+ }
236+
237+ // Deprecated: Use unsafe.String or unsafe.StringData instead.
238+ type StringHeader struct {
239+ Data uintptr
240+ Len intw
241+ }
242+
243+ // Verify SliceHeader and StringHeader sizes.
244+ // See https://github.com/tinygo-org/tinygo/pull/4156
245+ // and https://github.com/tinygo-org/tinygo/issues/1284.
246+ var (
247+ _ [unsafe .Sizeof ([]byte {})]byte = [unsafe .Sizeof (SliceHeader {})]byte {}
248+ _ [unsafe .Sizeof ("" )]byte = [unsafe .Sizeof (StringHeader {})]byte {}
249+ )
You can’t perform that action at this time.
0 commit comments