diff options
author | Matthew Dempsky <mdempsky@google.com> | 2019-08-30 10:56:30 -0700 |
---|---|---|
committer | Matthew Dempsky <mdempsky@google.com> | 2019-09-03 17:52:06 +0000 |
commit | 9f89edcd9668bb3b011961fbcdd8fc2796acba5d (patch) | |
tree | fac2ea3d67038eff5b913af5cb6b24224c94767f /test/escape_field.go | |
parent | a71967e4c5aa34f274b8b9aff915f14ac00e7ee8 (diff) | |
download | go-9f89edcd9668bb3b011961fbcdd8fc2796acba5d.tar.gz go-9f89edcd9668bb3b011961fbcdd8fc2796acba5d.zip |
cmd/compile: silence esc diagnostics about directiface OCONVIFACEs
In general, a conversion to interface type may require values to be
boxed, which in turn necessitates escape analysis to determine whether
the boxed representation can be stack allocated.
However, esc.go used to unconditionally print escape analysis
decisions about OCONVIFACE, even for conversions that don't require
boxing (e.g., pointers, channels, maps, functions).
For test compatibility with esc.go, escape.go similarly printed these
useless diagnostics. This CL removes the diagnostics, and updates test
expectations accordingly.
Change-Id: I97c57a4a08e44d265bba516c78426ff4f2bf1e12
Reviewed-on: https://go-review.googlesource.com/c/go/+/192697
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Diffstat (limited to 'test/escape_field.go')
-rw-r--r-- | test/escape_field.go | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/test/escape_field.go b/test/escape_field.go index 7291f94e50..8bb1a99553 100644 --- a/test/escape_field.go +++ b/test/escape_field.go @@ -24,7 +24,7 @@ func field0() { i := 0 // ERROR "moved to heap: i$" var x X x.p1 = &i - sink = x.p1 // ERROR "x\.p1 escapes to heap" + sink = x.p1 } func field1() { @@ -32,14 +32,14 @@ func field1() { var x X // BAD: &i should not escape x.p1 = &i - sink = x.p2 // ERROR "x\.p2 escapes to heap" + sink = x.p2 } func field3() { i := 0 // ERROR "moved to heap: i$" var x X x.p1 = &i - sink = x // ERROR "x escapes to heap" + sink = x // ERROR "x escapes to heap" } func field4() { @@ -55,12 +55,12 @@ func field5() { var x X // BAD: &i should not escape here x.a[0] = &i - sink = x.a[1] // ERROR "x\.a\[1\] escapes to heap" + sink = x.a[1] } // BAD: we are not leaking param x, only x.p2 func field6(x *X) { // ERROR "leaking param content: x$" - sink = x.p2 // ERROR "x\.p2 escapes to heap" + sink = x.p2 } func field6a() { @@ -88,7 +88,7 @@ func field8() { x := y.x var y1 Y y1.x = x - sink = y1.x.p1 // ERROR "y1\.x\.p1 escapes to heap" + sink = y1.x.p1 } func field9() { @@ -109,39 +109,39 @@ func field10() { x := y.x var y1 Y y1.x = x - sink = y1.x.p2 // ERROR "y1\.x\.p2 escapes to heap" + sink = y1.x.p2 } func field11() { - i := 0 // ERROR "moved to heap: i$" + i := 0 // ERROR "moved to heap: i$" x := X{p1: &i} - sink = x.p1 // ERROR "x\.p1 escapes to heap" + sink = x.p1 } func field12() { i := 0 // ERROR "moved to heap: i$" // BAD: &i should not escape x := X{p1: &i} - sink = x.p2 // ERROR "x\.p2 escapes to heap" + sink = x.p2 } func field13() { i := 0 // ERROR "moved to heap: i$" x := &X{p1: &i} // ERROR "field13 &X literal does not escape$" - sink = x.p1 // ERROR "x\.p1 escapes to heap" + sink = x.p1 } func field14() { i := 0 // ERROR "moved to heap: i$" // BAD: &i should not escape x := &X{p1: &i} // ERROR "field14 &X literal does not escape$" - sink = x.p2 // ERROR "x\.p2 escapes to heap" + sink = x.p2 } func field15() { i := 0 // ERROR "moved to heap: i$" x := &X{p1: &i} // ERROR "&X literal escapes to heap$" - sink = x // ERROR "x escapes to heap" + sink = x } func field16() { @@ -151,7 +151,7 @@ func field16() { x.p1 = &i var iface interface{} = x // ERROR "field16 x does not escape" x1 := iface.(X) - sink = x1.p2 // ERROR "x1\.p2 escapes to heap" + sink = x1.p2 } func field17() { @@ -160,7 +160,7 @@ func field17() { x.p1 = &i var iface interface{} = x // ERROR "field17 x does not escape" x1 := iface.(X) - sink = x1.p1 // ERROR "x1\.p1 escapes to heap" + sink = x1.p1 } func field18() { |