]> Cypherpunks repositories - gostls13.git/commit
runtime: make SetFinalizer(x, f) accept any f for which f(x) is valid
authorRuss Cox <rsc@golang.org>
Wed, 14 Aug 2013 18:54:31 +0000 (14:54 -0400)
committerRuss Cox <rsc@golang.org>
Wed, 14 Aug 2013 18:54:31 +0000 (14:54 -0400)
commit5822e7848a5c355f694c22dce4a1da43f2793441
tree25cb8d833d4b391d332799aaafd715c08a7d0fe3
parent2560f8fe223a35aa5a6b203a3bfd922cb4bd819e
runtime: make SetFinalizer(x, f) accept any f for which f(x) is valid

Originally the requirement was f(x) where f's argument is
exactly x's type.

CL 11858043 relaxed the requirement in a non-standard
way: f's argument must be exactly x's type or interface{}.

If we're going to relax the requirement, it should be done
in a way consistent with the rest of Go. This CL allows f's
argument to have any type for which x is assignable;
that's the same requirement the compiler would impose
if compiling f(x) directly.

Fixes #5368.

R=dvyukov, bradfitz, pieter
CC=golang-dev
https://golang.org/cl/12895043
src/pkg/runtime/extern.go
src/pkg/runtime/iface.c
src/pkg/runtime/malloc.goc
src/pkg/runtime/malloc.h
src/pkg/runtime/mfinal.c
src/pkg/runtime/mfinal_test.go
src/pkg/runtime/mgc0.c
src/pkg/runtime/runtime.h
src/pkg/runtime/type.h