1 // errorcheck -0 -m -d=escapemutationscalls,zerocopy -l
3 // Copyright 2023 The Go Authors. All rights reserved.
4 // Use of this source code is governed by a BSD-style
5 // license that can be found in the LICENSE file.
17 func F1(b *B) { // ERROR "mutates param: b derefs=0"
21 func F2(b *B) { // ERROR "mutates param: b derefs=1"
25 func F2a(b *B) { // ERROR "mutates param: b derefs=0"
29 func F3(b *B) { // ERROR "leaking param: b"
30 fmt.Println(b) // ERROR "\.\.\. argument does not escape"
33 func F4(b *B) { // ERROR "leaking param content: b"
34 fmt.Println(*b) // ERROR "\.\.\. argument does not escape" "\*b escapes to heap"
37 func F4a(b *B) { // ERROR "leaking param content: b" "mutates param: b derefs=0"
39 fmt.Println(*b) // ERROR "\.\.\. argument does not escape" "\*b escapes to heap"
42 func F5(b *B) { // ERROR "leaking param: b"
46 func F6(b *B) int { // ERROR "b does not escape, mutate, or call"
53 var b B // ERROR "moved to heap: b"
61 func g(s string) { // ERROR "s does not escape, mutate, or call"
62 sink = &([]byte(s))[10] // ERROR "\(\[\]byte\)\(s\) escapes to heap"
65 func h(out []byte, s string) { // ERROR "mutates param: out derefs=0" "s does not escape, mutate, or call"
66 copy(out, []byte(s)) // ERROR "zero-copy string->\[\]byte conversion" "\(\[\]byte\)\(s\) does not escape"
69 func i(s string) byte { // ERROR "s does not escape, mutate, or call"
70 p := []byte(s) // ERROR "zero-copy string->\[\]byte conversion" "\(\[\]byte\)\(s\) does not escape"
74 func j(s string, x byte) { // ERROR "s does not escape, mutate, or call"
75 p := []byte(s) // ERROR "\(\[\]byte\)\(s\) does not escape"