diff options
author | Matthew Dempsky <mdempsky@google.com> | 2019-04-01 14:01:58 -0700 |
---|---|---|
committer | Matthew Dempsky <mdempsky@google.com> | 2019-04-02 18:00:32 +0000 |
commit | 131eb8fbf80fd8b51ae8b5c5220d566582a41e71 (patch) | |
tree | 7a3f7751dccc028633d8b32abc2c743c04412f25 /test/escape2.go | |
parent | e29f74efb90b8a7f20fd4ffce4038c824c173f50 (diff) | |
download | go-131eb8fbf80fd8b51ae8b5c5220d566582a41e71.tar.gz go-131eb8fbf80fd8b51ae8b5c5220d566582a41e71.zip |
cmd/compile: trim more unnecessary escape analysis messages
"leaking closure reference" is redundant for similar reasons as "&x
escapes to heap" for OADDR nodes: the reference itself does not
allocate, and we already report when the referenced variable is moved
to heap.
"mark escaped content" is redundant with "leaking param content".
Updates #23109.
Change-Id: I1ab599cb1e8434f1918dd80596a70cba7dc8a0cf
Reviewed-on: https://go-review.googlesource.com/c/go/+/170321
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Diffstat (limited to 'test/escape2.go')
-rw-r--r-- | test/escape2.go | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/test/escape2.go b/test/escape2.go index a95f89a5cd..e3561a0f60 100644 --- a/test/escape2.go +++ b/test/escape2.go @@ -1186,7 +1186,7 @@ func foo124(x **int) { // ERROR "foo124 x does not escape$" var i int // ERROR "moved to heap: i$" p := &i func() { // ERROR "foo124 func literal does not escape$" - *x = p // ERROR "leaking closure reference p$" + *x = p }() } @@ -1194,7 +1194,7 @@ func foo125(ch chan *int) { // ERROR "foo125 ch does not escape$" var i int // ERROR "moved to heap: i$" p := &i func() { // ERROR "foo125 func literal does not escape$" - ch <- p // ERROR "leaking closure reference p$" + ch <- p }() } @@ -1204,7 +1204,7 @@ func foo126() { // loopdepth 1 var i int // ERROR "moved to heap: i$" func() { // ERROR "foo126 func literal does not escape$" - px = &i // ERROR "leaking closure reference i" + px = &i }() } _ = px @@ -1230,9 +1230,9 @@ func foo129() { var i int // ERROR "moved to heap: i$" p := &i func() { // ERROR "foo129 func literal does not escape$" - q := p // ERROR "leaking closure reference p$" + q := p func() { // ERROR "foo129.func1 func literal does not escape$" - r := q // ERROR "leaking closure reference q$" + r := q px = r }() }() @@ -1242,7 +1242,7 @@ func foo130() { for { var i int // ERROR "moved to heap: i$" func() { // ERROR "foo130 func literal does not escape$" - px = &i // ERROR "leaking closure reference i$" + px = &i }() } } @@ -1250,21 +1250,21 @@ func foo130() { func foo131() { var i int // ERROR "moved to heap: i$" func() { // ERROR "foo131 func literal does not escape$" - px = &i // ERROR "leaking closure reference i$" + px = &i }() } func foo132() { var i int // ERROR "moved to heap: i$" go func() { // ERROR "func literal escapes to heap$" - px = &i // ERROR "leaking closure reference i$" + px = &i }() } func foo133() { var i int // ERROR "moved to heap: i$" defer func() { // ERROR "foo133 func literal does not escape$" - px = &i // ERROR "leaking closure reference i$" + px = &i }() } @@ -1296,9 +1296,9 @@ func foo136() { var i int // ERROR "moved to heap: i$" p := &i go func() { // ERROR "func literal escapes to heap$" - q := p // ERROR "leaking closure reference p$" + q := p func() { // ERROR "foo136.func1 func literal does not escape$" - r := q // ERROR "leaking closure reference q$" + r := q px = r }() }() @@ -1308,7 +1308,7 @@ func foo137() { var i int // ERROR "moved to heap: i$" p := &i func() { // ERROR "foo137 func literal does not escape$" - q := p // ERROR "leaking closure reference p$" + q := p go func() { // ERROR "func literal escapes to heap$" r := q _ = r |