Home | History | Annotate | Download | only in test

Lines Matching defs:escape

7 // Test escape analysis for closure arguments.
9 package escape
15 func(p *int) { // ERROR "p does not escape" "func literal does not escape"
17 // BAD: x should not escape to heap here
24 func(p *int) { // ERROR "p does not escape" "func literal does not escape"
26 // BAD: x should not escape to heap here
33 // BAD: x should not escape here
35 func(p *int) { // ERROR "p does not escape" "func literal does not escape"
43 func(p *int) { // ERROR "leaking param: p" "func literal does not escape"
51 _ = func(p *int) *int { // ERROR "leaking param: p to result ~r1" "func literal does not escape"
58 sink = func(p *int) *int { // ERROR "leaking param: p to result ~r1" "func literal does not escape" "\(func literal\)\(&x\) escapes to heap"
65 func(p *int) { // ERROR "moved to heap: p" "func literal does not escape"
74 func(p *int) { // ERROR "leaking param: p" "func literal does not escape"
83 defer func(p *int) { // ERROR "p does not escape" "func literal does not escape"
85 // BAD: x should not escape to heap here
93 defer func(p *int) { // ERROR "func literal escapes to heap" "p does not escape"
102 defer func(p *int) { // ERROR "func literal escapes to heap" "p does not escape"
110 defer func(p *int) { // ERROR "leaking param: p" "func literal does not escape"
118 defer func(p *int) *int { // ERROR "leaking param: p to result ~r1" "func literal does not escape"
125 defer func(p *int) { // ERROR "moved to heap: p" "func literal does not escape"
132 // BAD: &x should not escape here
134 _ = func(p **int) *int { // ERROR "leaking param: p to result ~r1 level=1" "func literal does not escape"
136 // BAD: p should not escape here
143 sink = func(p **int) *int { // ERROR "leaking param: p to result ~r1 level=1" "func literal does not escape" "\(func literal\)\(&p\) escapes to heap"
145 // BAD: p should not escape here
149 func ClosureLeak1(s string) string { // ERROR "ClosureLeak1 s does not escape"
151 return ClosureLeak1a(t) // ERROR "ClosureLeak1 ... argument does not escape"
156 return func() string { // ERROR "ClosureLeak1a func literal does not escape"
161 func ClosureLeak2(s string) string { // ERROR "ClosureLeak2 s does not escape"
163 c := ClosureLeak2a(t) // ERROR "ClosureLeak2 ... argument does not escape"
167 return ClosureLeak2b(func() string { // ERROR "ClosureLeak2a func literal does not escape"