mirror of
https://github.com/golang/go
synced 2024-11-22 19:54:39 -07:00
reflect: deprecate PtrTo
Replace reflect.PtrTo with reflect.PointerTo.
Fixes #59599
Change-Id: I49407193e2050543ef983cd637703acc682d9f51
Change-Id: I49407193e2050543ef983cd637703acc682d9f51
GitHub-Last-Rev: 7bc9ccf1dc
GitHub-Pull-Request: golang/go#61440
Reviewed-on: https://go-review.googlesource.com/c/go/+/511035
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
This commit is contained in:
parent
737a5b0eaa
commit
93ec88160e
1
api/next/59599.txt
Normal file
1
api/next/59599.txt
Normal file
@ -0,0 +1 @@
|
||||
pkg reflect, func PtrTo //deprecated #59599
|
@ -1224,7 +1224,7 @@ func writeType(t *types.Type) *obj.LSym {
|
||||
keep := base.Ctxt.Flag_dynlink
|
||||
if !keep && t.Sym() == nil {
|
||||
// For an unnamed type, we only need the link if the type can
|
||||
// be created at run time by reflect.PtrTo and similar
|
||||
// be created at run time by reflect.PointerTo and similar
|
||||
// functions. If the type exists in the program, those
|
||||
// functions must return the existing type structure rather
|
||||
// than creating a new one.
|
||||
|
@ -656,7 +656,7 @@ func (dec *Decoder) decodeSlice(state *decoderState, value reflect.Value, elemOp
|
||||
errorf("%s slice too big: %d elements of %d bytes", typ.Elem(), u, size)
|
||||
}
|
||||
if value.Cap() < n {
|
||||
safe := saferio.SliceCap(reflect.Zero(reflect.PtrTo(typ.Elem())).Interface(), uint64(n))
|
||||
safe := saferio.SliceCap(reflect.Zero(reflect.PointerTo(typ.Elem())).Interface(), uint64(n))
|
||||
if safe < 0 {
|
||||
errorf("%s slice too big: %d elements of %d bytes", typ.Elem(), u, size)
|
||||
}
|
||||
|
@ -1171,6 +1171,8 @@ var ptrMap sync.Map // map[*rtype]*ptrType
|
||||
//
|
||||
// PtrTo is the old spelling of PointerTo.
|
||||
// The two functions behave identically.
|
||||
//
|
||||
// Deprecated: Superseded by [PointerTo].
|
||||
func PtrTo(t Type) Type { return PointerTo(t) }
|
||||
|
||||
// PointerTo returns the pointer type with element t.
|
||||
|
Loading…
Reference in New Issue
Block a user