Update to go1.25.0
This commit is contained in:
@@ -17,14 +17,14 @@ func FooN(vals ...*int) (s int) { // ERROR "vals does not escape"
|
||||
|
||||
// Append forces heap allocation and copies entries in vals to heap, therefore they escape to heap.
|
||||
func FooNx(x *int, vals ...*int) (s int) { // ERROR "leaking param: x" "leaking param content: vals"
|
||||
vals = append(vals, x)
|
||||
vals = append(vals, x) // ERROR "append does not escape"
|
||||
return FooN(vals...)
|
||||
}
|
||||
|
||||
var sink []*int
|
||||
|
||||
func FooNy(x *int, vals ...*int) (s int) { // ERROR "leaking param: x" "leaking param: vals"
|
||||
vals = append(vals, x)
|
||||
vals = append(vals, x) // ERROR "append escapes to heap"
|
||||
sink = vals
|
||||
return FooN(vals...)
|
||||
}
|
||||
@@ -84,7 +84,7 @@ func TFooI() {
|
||||
a := int32(1) // ERROR "moved to heap: a"
|
||||
b := "cat"
|
||||
c := &a
|
||||
FooI(a, b, c) // ERROR "a escapes to heap" "b escapes to heap" "... argument does not escape"
|
||||
FooI(a, b, c) // ERROR "a escapes to heap" ".cat. escapes to heap" "... argument does not escape"
|
||||
}
|
||||
|
||||
func FooJ(args ...interface{}) *int32 { // ERROR "leaking param: args to result ~r0 level=1"
|
||||
@@ -108,14 +108,14 @@ func TFooJ1() {
|
||||
a := int32(1)
|
||||
b := "cat"
|
||||
c := &a
|
||||
FooJ(a, b, c) // ERROR "a does not escape" "b does not escape" "... argument does not escape"
|
||||
FooJ(a, b, c) // ERROR "a does not escape" ".cat. does not escape" "... argument does not escape"
|
||||
}
|
||||
|
||||
func TFooJ2() {
|
||||
a := int32(1) // ERROR "moved to heap: a"
|
||||
b := "cat"
|
||||
c := &a
|
||||
isink = FooJ(a, b, c) // ERROR "a escapes to heap" "b escapes to heap" "... argument does not escape"
|
||||
isink = FooJ(a, b, c) // ERROR "a escapes to heap" ".cat. escapes to heap" "... argument does not escape"
|
||||
}
|
||||
|
||||
type fakeSlice struct {
|
||||
@@ -144,7 +144,7 @@ func TFooK2() {
|
||||
a := int32(1) // ERROR "moved to heap: a"
|
||||
b := "cat"
|
||||
c := &a
|
||||
fs := fakeSlice{3, &[4]interface{}{a, b, c, nil}} // ERROR "a escapes to heap" "b escapes to heap" "&\[4\]interface {}{...} does not escape"
|
||||
fs := fakeSlice{3, &[4]interface{}{a, b, c, nil}} // ERROR "a escapes to heap" ".cat. escapes to heap" "&\[4\]interface {}{...} does not escape"
|
||||
isink = FooK(fs)
|
||||
}
|
||||
|
||||
@@ -169,6 +169,6 @@ func TFooL2() {
|
||||
a := int32(1) // ERROR "moved to heap: a"
|
||||
b := "cat"
|
||||
c := &a
|
||||
s := []interface{}{a, b, c} // ERROR "a escapes to heap" "b escapes to heap" "\[\]interface {}{...} does not escape"
|
||||
s := []interface{}{a, b, c} // ERROR "a escapes to heap" ".cat. escapes to heap" "\[\]interface {}{...} does not escape"
|
||||
isink = FooL(s)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user