diff options
author | Elias Naur <elias.naur@gmail.com> | 2016-09-22 09:37:28 +0200 |
---|---|---|
committer | Brad Fitzpatrick <bradfitz@golang.org> | 2016-09-27 16:38:47 +0000 |
commit | 60482d8a8b11a3dfdf9b582b9f666694d84bb9c4 (patch) | |
tree | a08a344fcfe3343cc166fc57c82e1ae6b0b03656 /src/runtime/mfinal.go | |
parent | 413f1ef4de98f2e98853c3753f785871bfc32e5d (diff) | |
download | go-60482d8a8b11a3dfdf9b582b9f666694d84bb9c4.tar.gz go-60482d8a8b11a3dfdf9b582b9f666694d84bb9c4.zip |
runtime: relax SetFinalizer documentation to allow &local
The SetFinalizer documentation states that
"The argument obj must be a pointer to an object allocated by calling
new or by taking the address of a composite literal."
which precludes pointers to local variables. According to a comment
on #6591, this case is expected to work. This CL updates the documentation
for SetFinalizer accordingly.
Fixes #6591
Change-Id: Id861b3436bc1c9521361ea2d51c1ce74a121c1af
Reviewed-on: https://go-review.googlesource.com/29592
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
Diffstat (limited to 'src/runtime/mfinal.go')
-rw-r--r-- | src/runtime/mfinal.go | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/runtime/mfinal.go b/src/runtime/mfinal.go index 9bad6f0aa3..b3f30dd5ae 100644 --- a/src/runtime/mfinal.go +++ b/src/runtime/mfinal.go @@ -226,8 +226,9 @@ func runfinq() { // // SetFinalizer(obj, nil) clears any finalizer associated with obj. // -// The argument obj must be a pointer to an object allocated by -// calling new or by taking the address of a composite literal. +// The argument obj must be a pointer to an object allocated by calling +// new, by taking the address of a composite literal, or by taking the +// 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 |