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_closure.go | |
parent | a71967e4c5aa34f274b8b9aff915f14ac00e7ee8 (diff) | |
download | go-git-9f89edcd9668bb3b011961fbcdd8fc2796acba5d.tar.gz |
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_closure.go')
-rw-r--r-- | test/escape_closure.go | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/test/escape_closure.go b/test/escape_closure.go index 57aabc5b55..f9f3c0fbd4 100644 --- a/test/escape_closure.go +++ b/test/escape_closure.go @@ -38,7 +38,7 @@ func ClosureCallArgs2() { func ClosureCallArgs3() { x := 0 // ERROR "moved to heap: x" func(p *int) { // ERROR "leaking param: p" "func literal does not escape" - sink = p // ERROR "p escapes to heap" + sink = p }(&x) } @@ -53,7 +53,7 @@ func ClosureCallArgs5() { x := 0 // ERROR "moved to heap: x" // TODO(mdempsky): We get "leaking param: p" here because the new escape analysis pass // can tell that p flows directly to sink, but it's a little weird. Re-evaluate. - sink = func(p *int) *int { // ERROR "leaking param: p" "func literal does not escape" "\(func literal\)\(&x\) escapes to heap" + sink = func(p *int) *int { // ERROR "leaking param: p" "func literal does not escape" return p }(&x) } @@ -61,7 +61,7 @@ func ClosureCallArgs5() { func ClosureCallArgs6() { x := 0 // ERROR "moved to heap: x" func(p *int) { // ERROR "moved to heap: p" "func literal does not escape" - sink = &p // ERROR "&p escapes to heap" + sink = &p }(&x) } @@ -105,7 +105,7 @@ func ClosureCallArgs10() { func ClosureCallArgs11() { x := 0 // ERROR "moved to heap: x" defer func(p *int) { // ERROR "leaking param: p" "func literal does not escape" - sink = p // ERROR "p escapes to heap" + sink = p }(&x) } @@ -119,7 +119,7 @@ func ClosureCallArgs12() { func ClosureCallArgs13() { x := 0 // ERROR "moved to heap: x" defer func(p *int) { // ERROR "moved to heap: p" "func literal does not escape" - sink = &p // ERROR "&p escapes to heap" + sink = &p }(&x) } @@ -134,7 +134,7 @@ func ClosureCallArgs14() { func ClosureCallArgs15() { x := 0 // ERROR "moved to heap: x" p := &x - sink = func(p **int) *int { // ERROR "leaking param content: p" "func literal does not escape" "\(func literal\)\(&p\) escapes to heap" + sink = func(p **int) *int { // ERROR "leaking param content: p" "func literal does not escape" return *p }(&p) } |