aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/mfinal.go
diff options
context:
space:
mode:
authorAustin Clements <austin@google.com>2016-10-03 11:52:20 -0400
committerAustin Clements <austin@google.com>2016-10-03 16:12:48 +0000
commit99339dd44537f82c9a1348b8937b68b6c61be005 (patch)
treef45ae64fc77cd63517041d3e268becba5edad355 /src/runtime/mfinal.go
parent22a2bdfedb95612984cec3141924953b88a607b7 (diff)
downloadgo-99339dd44537f82c9a1348b8937b68b6c61be005.tar.gz
go-99339dd44537f82c9a1348b8937b68b6c61be005.zip
runtime: weaken claim about SetFinalizer panicking
Currently the SetFinalizer documentation makes a strong claim that SetFinalizer will panic if the pointer is not to an object allocated by calling new, to a composite literal, or to a local variable. This is not true. For example, it doesn't panic when passed the address of a package-level variable. Nor can we practically make it true. For example, we can't distinguish between passing a pointer to a composite literal and passing a pointer to its first field. Hence, weaken the guarantee to say that it "may" panic. Updates #17311. (Might fix it, depending on what we want to do with package-level variables.) Change-Id: I1c68ea9d0a5bbd3dd1b7ce329d92b0f05e2e0877 Reviewed-on: https://go-review.googlesource.com/30137 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Diffstat (limited to 'src/runtime/mfinal.go')
-rw-r--r--src/runtime/mfinal.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/runtime/mfinal.go b/src/runtime/mfinal.go
index b3f30dd5ae..f9344882b1 100644
--- a/src/runtime/mfinal.go
+++ b/src/runtime/mfinal.go
@@ -231,7 +231,7 @@ func runfinq() {
// address of a local variable.
// The argument finalizer must be a function that takes a single argument
// to which obj's type can be assigned, and can have arbitrary ignored return
-// values. If either of these is not true, SetFinalizer aborts the
+// values. If either of these is not true, SetFinalizer may abort the
// program.
//
// Finalizers are run in dependency order: if A points at B, both have