aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/error.go
diff options
context:
space:
mode:
authorMatthew Dempsky <mdempsky@google.com>2015-10-21 12:12:25 -0700
committerMatthew Dempsky <mdempsky@google.com>2015-10-21 23:08:22 +0000
commit84afa1be76f89a602c1aef73603175e644f1dc2f (patch)
tree090b42d927619808e5c4bb61461dfc20b5857463 /src/runtime/error.go
parent03b0065204df9cd141919890b23de6291ab52885 (diff)
downloadgo-84afa1be76f89a602c1aef73603175e644f1dc2f.tar.gz
go-84afa1be76f89a602c1aef73603175e644f1dc2f.zip
runtime: make iface/eface handling more type safe
Change compiler-invoked interface functions to directly take iface/eface parameters instead of fInterface/interface{} to avoid needing to always convert. For the handful of functions that legitimately need to take an interface{} parameter, add efaceOf to type-safely convert *interface{} to *eface. Change-Id: I8928761a12fd3c771394f36adf93d3006a9fcf39 Reviewed-on: https://go-review.googlesource.com/16166 Run-TryBot: Matthew Dempsky <mdempsky@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
Diffstat (limited to 'src/runtime/error.go')
-rw-r--r--src/runtime/error.go4
1 files changed, 1 insertions, 3 deletions
diff --git a/src/runtime/error.go b/src/runtime/error.go
index 4280306ac5..de07bcb643 100644
--- a/src/runtime/error.go
+++ b/src/runtime/error.go
@@ -4,8 +4,6 @@
package runtime
-import "unsafe"
-
// The Error interface identifies a run time error.
type Error interface {
error
@@ -57,7 +55,7 @@ type stringer interface {
}
func typestring(x interface{}) string {
- e := (*eface)(unsafe.Pointer(&x))
+ e := efaceOf(&x)
return *e._type._string
}