package foo
-func f(buf []byte) []byte { // ERROR "leaking param: buf to result ~r1 level=0$"
+func f(buf []byte) []byte { // ERROR "leaking param: buf to result ~r0 level=0$"
return buf
}
func h(e int) {
var x [32]byte // ERROR "moved to heap: x$"
- g(&f(x[:])[0]) // ERROR "&f\(x\[:\]\)\[0\] escapes to heap$" "x escapes to heap$"
+ g(&f(x[:])[0])
}
type Node struct {
if n == nil {
return 0
}
- wl := walk(&n.left) // ERROR "walk &n.left does not escape"
- wr := walk(&n.right) // ERROR "walk &n.right does not escape"
+ wl := walk(&n.left)
+ wr := walk(&n.right)
if wl < wr {
- n.left, n.right = n.right, n.left
+ n.left, n.right = n.right, n.left // ERROR "ignoring self-assignment"
wl, wr = wr, wl
}
*np = n
}
// Test for bug where func var f used prototype's escape analysis results.
-func prototype(xyz []string) {} // ERROR "prototype xyz does not escape"
+func prototype(xyz []string) {} // ERROR "xyz does not escape"
func bar() {
var got [][]string
f := prototype
f = func(ss []string) { got = append(got, ss) } // ERROR "leaking param: ss" "func literal does not escape"
s := "string"
- f([]string{s}) // ERROR "\[\]string literal escapes to heap"
+ f([]string{s}) // ERROR "\[\]string{...} escapes to heap"
}