aboutsummaryrefslogtreecommitdiff
path: root/test/escape_slice.go
diff options
context:
space:
mode:
authorMatthew Dempsky <mdempsky@google.com>2021-05-26 13:54:31 -0700
committerMatthew Dempsky <mdempsky@google.com>2021-05-26 23:50:32 +0000
commite99e9a6e0147592b12175a19a2a9dafe96a984f9 (patch)
tree0f46c545036f9ec5ccff9d38a8272c2e440b9cb4 /test/escape_slice.go
parent4c68edd1feaad43e098dd7375d6c1cfc43243211 (diff)
downloadgo-e99e9a6e0147592b12175a19a2a9dafe96a984f9.tar.gz
go-e99e9a6e0147592b12175a19a2a9dafe96a984f9.zip
[dev.typeparams] cmd/compile: simplify ~r/~b naming
The compiler renames anonymous and blank result parameters to ~rN or ~bN, but the current semantics for computing N are rather annoying and difficult to reproduce cleanly. They also lead to difficult to read escape analysis results in tests. This CL changes N to always be calculated as the parameter's index within the function's result parameter tuple. E.g., if a function has a single result, it will now always be named "~r0". The normative change to this CL is fairly simple, but it requires updating a lot of test expectations. Change-Id: I58a3c94de00cb822cb94efe52d115531193c993c Reviewed-on: https://go-review.googlesource.com/c/go/+/323010 Trust: Matthew Dempsky <mdempsky@google.com> Trust: Dan Scales <danscales@google.com> Run-TryBot: Matthew Dempsky <mdempsky@google.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Dan Scales <danscales@google.com>
Diffstat (limited to 'test/escape_slice.go')
-rw-r--r--test/escape_slice.go4
1 files changed, 2 insertions, 2 deletions
diff --git a/test/escape_slice.go b/test/escape_slice.go
index d60414736c..055b60be41 100644
--- a/test/escape_slice.go
+++ b/test/escape_slice.go
@@ -101,7 +101,7 @@ func slice11() {
_ = s
}
-func slice12(x []int) *[1]int { // ERROR "leaking param: x to result ~r1 level=0$"
+func slice12(x []int) *[1]int { // ERROR "leaking param: x to result ~r0 level=0$"
return (*[1]int)(x)
}
@@ -110,7 +110,7 @@ func envForDir(dir string) []string { // ERROR "dir does not escape"
return mergeEnvLists([]string{"PWD=" + dir}, env) // ERROR ".PWD=. \+ dir escapes to heap" "\[\]string{...} does not escape"
}
-func mergeEnvLists(in, out []string) []string { // ERROR "leaking param content: in" "leaking param content: out" "leaking param: out to result ~r2 level=0"
+func mergeEnvLists(in, out []string) []string { // ERROR "leaking param content: in" "leaking param content: out" "leaking param: out to result ~r0 level=0"
NextVar:
for _, inkv := range in {
k := strings.SplitAfterN(inkv, "=", 2)[0]