1
0
mirror of https://github.com/golang/go synced 2024-11-26 09:58:04 -07:00

sync/atomic: disallow type conversions of atomic.Pointer[T]

Fixes #56603

Change-Id: I6af9d80201025ae4028bfaa4a62e5de9ac0c501d
GitHub-Last-Rev: e6ed5e1451
GitHub-Pull-Request: golang/go#56604
Reviewed-on: https://go-review.googlesource.com/c/go/+/448275
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
This commit is contained in:
Mateusz Poliwczak 2022-11-07 14:54:52 +00:00 committed by Michael Knyszek
parent f3d656be50
commit 6bead8f77a

View File

@ -41,6 +41,10 @@ var _ = &Pointer[int]{}
// A Pointer is an atomic pointer of type *T. The zero value is a nil *T.
type Pointer[T any] struct {
// Mention T in a field to disallow conversion between Pointer types.
// See go.dev/issue/56603 for more details.
_ [0]T
_ noCopy
v unsafe.Pointer
}