Closed
Description
func X() {
x := 9
p := weak.Make(&x)
}
https://cs.opensource.google/go/go/+/refs/tags/go1.24.4:src/weak/pointer.go;l=67:
// Make creates a weak pointer from a pointer to some value of type T.
func Make[T any](ptr *T) Pointer[T] {
// Explicitly force ptr to escape to the heap. <------ ???
Can the documentation clarify if weak.Make
makes objects that should be in the stack move to heap?
In the above snippet, will x
get moved to the heap? It is meant to only be used within X() and does not otherwise escape.