mirror of
https://github.com/golang/go
synced 2024-11-02 11:50:30 +00:00
reflect: deprecate PtrTo
Replace reflect.PtrTo with reflect.PointerTo Fixes #59599 Change-Id: I49407193e2050543ef983cd637703acc682d9f51
This commit is contained in:
parent
28ca813a13
commit
7bc9ccf1dc
4 changed files with 5 additions and 2 deletions
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 a new issue