mirror of
https://github.com/golang/go
synced 2024-11-26 10:58:16 -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:
parent
f3d656be50
commit
6bead8f77a
@ -41,6 +41,10 @@ var _ = &Pointer[int]{}
|
|||||||
|
|
||||||
// A Pointer is an atomic pointer of type *T. The zero value is a nil *T.
|
// A Pointer is an atomic pointer of type *T. The zero value is a nil *T.
|
||||||
type Pointer[T any] struct {
|
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
|
_ noCopy
|
||||||
v unsafe.Pointer
|
v unsafe.Pointer
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user