@@ -118,15 +118,15 @@ type Bar struct {
118
118
}
119
119
120
120
func NewBar () * Bar {
121
- return & Bar {42 , nil } // ERROR "&Bar literal escapes to heap$"
121
+ return & Bar {42 , nil } // ERROR "&Bar{...} escapes to heap$"
122
122
}
123
123
124
124
func NewBarp (x * int ) * Bar { // ERROR "leaking param: x$"
125
- return & Bar {42 , x } // ERROR "&Bar literal escapes to heap$"
125
+ return & Bar {42 , x } // ERROR "&Bar{...} escapes to heap$"
126
126
}
127
127
128
128
func NewBarp2 (x * int ) * Bar { // ERROR "x does not escape$"
129
- return & Bar {* x , nil } // ERROR "&Bar literal escapes to heap$"
129
+ return & Bar {* x , nil } // ERROR "&Bar{...} escapes to heap$"
130
130
}
131
131
132
132
func (b * Bar ) NoLeak () int { // ERROR "b does not escape$"
@@ -173,7 +173,7 @@ type Bar2 struct {
173
173
}
174
174
175
175
func NewBar2 () * Bar2 {
176
- return & Bar2 {[12 ]int {42 }, nil } // ERROR "&Bar2 literal escapes to heap$"
176
+ return & Bar2 {[12 ]int {42 }, nil } // ERROR "&Bar2{...} escapes to heap$"
177
177
}
178
178
179
179
func (b * Bar2 ) NoLeak () int { // ERROR "b does not escape$"
@@ -539,7 +539,7 @@ func foo72b() [10]*int {
539
539
540
540
// issue 2145
541
541
func foo73 () {
542
- s := []int {3 , 2 , 1 } // ERROR "\[\]int literal does not escape$"
542
+ s := []int {3 , 2 , 1 } // ERROR "\[\]int{...} does not escape$"
543
543
for _ , v := range s {
544
544
vv := v
545
545
// actually just escapes its scope
@@ -550,7 +550,7 @@ func foo73() {
550
550
}
551
551
552
552
func foo731 () {
553
- s := []int {3 , 2 , 1 } // ERROR "\[\]int literal does not escape$"
553
+ s := []int {3 , 2 , 1 } // ERROR "\[\]int{...} does not escape$"
554
554
for _ , v := range s {
555
555
vv := v // ERROR "moved to heap: vv$"
556
556
// actually just escapes its scope
@@ -562,7 +562,7 @@ func foo731() {
562
562
}
563
563
564
564
func foo74 () {
565
- s := []int {3 , 2 , 1 } // ERROR "\[\]int literal does not escape$"
565
+ s := []int {3 , 2 , 1 } // ERROR "\[\]int{...} does not escape$"
566
566
for _ , v := range s {
567
567
vv := v
568
568
// actually just escapes its scope
@@ -574,7 +574,7 @@ func foo74() {
574
574
}
575
575
576
576
func foo74a () {
577
- s := []int {3 , 2 , 1 } // ERROR "\[\]int literal does not escape$"
577
+ s := []int {3 , 2 , 1 } // ERROR "\[\]int{...} does not escape$"
578
578
for _ , v := range s {
579
579
vv := v // ERROR "moved to heap: vv$"
580
580
// actually just escapes its scope
@@ -589,7 +589,7 @@ func foo74a() {
589
589
// issue 3975
590
590
func foo74b () {
591
591
var array [3 ]func ()
592
- s := []int {3 , 2 , 1 } // ERROR "\[\]int literal does not escape$"
592
+ s := []int {3 , 2 , 1 } // ERROR "\[\]int{...} does not escape$"
593
593
for i , v := range s {
594
594
vv := v
595
595
// actually just escapes its scope
@@ -601,7 +601,7 @@ func foo74b() {
601
601
602
602
func foo74c () {
603
603
var array [3 ]func ()
604
- s := []int {3 , 2 , 1 } // ERROR "\[\]int literal does not escape$"
604
+ s := []int {3 , 2 , 1 } // ERROR "\[\]int{...} does not escape$"
605
605
for i , v := range s {
606
606
vv := v // ERROR "moved to heap: vv$"
607
607
// actually just escapes its scope
@@ -759,15 +759,15 @@ type LimitedFooer struct {
759
759
}
760
760
761
761
func LimitFooer (r Fooer , n int64 ) Fooer { // ERROR "leaking param: r$"
762
- return & LimitedFooer {r , n } // ERROR "&LimitedFooer literal escapes to heap$"
762
+ return & LimitedFooer {r , n } // ERROR "&LimitedFooer{...} escapes to heap$"
763
763
}
764
764
765
765
func foo90 (x * int ) map [* int ]* int { // ERROR "leaking param: x$"
766
- return map [* int ]* int {nil : x } // ERROR "map\[\*int\]\*int literal escapes to heap$"
766
+ return map [* int ]* int {nil : x } // ERROR "map\[\*int\]\*int{...} escapes to heap$"
767
767
}
768
768
769
769
func foo91 (x * int ) map [* int ]* int { // ERROR "leaking param: x$"
770
- return map [* int ]* int {x : nil } // ERROR "map\[\*int\]\*int literal escapes to heap$"
770
+ return map [* int ]* int {x : nil } // ERROR "map\[\*int\]\*int{...} escapes to heap$"
771
771
}
772
772
773
773
func foo92 (x * int ) [2 ]* int { // ERROR "leaking param: x to result ~r1 level=0$"
@@ -870,28 +870,28 @@ func foo106(x *int) { // ERROR "leaking param: x$"
870
870
}
871
871
872
872
func foo107 (x * int ) map [* int ]* int { // ERROR "leaking param: x$"
873
- return map [* int ]* int {x : nil } // ERROR "map\[\*int\]\*int literal escapes to heap$"
873
+ return map [* int ]* int {x : nil } // ERROR "map\[\*int\]\*int{...} escapes to heap$"
874
874
}
875
875
876
876
func foo108 (x * int ) map [* int ]* int { // ERROR "leaking param: x$"
877
- return map [* int ]* int {nil : x } // ERROR "map\[\*int\]\*int literal escapes to heap$"
877
+ return map [* int ]* int {nil : x } // ERROR "map\[\*int\]\*int{...} escapes to heap$"
878
878
}
879
879
880
880
func foo109 (x * int ) * int { // ERROR "leaking param: x$"
881
- m := map [* int ]* int {x : nil } // ERROR "map\[\*int\]\*int literal does not escape$"
881
+ m := map [* int ]* int {x : nil } // ERROR "map\[\*int\]\*int{...} does not escape$"
882
882
for k , _ := range m {
883
883
return k
884
884
}
885
885
return nil
886
886
}
887
887
888
888
func foo110 (x * int ) * int { // ERROR "leaking param: x$"
889
- m := map [* int ]* int {nil : x } // ERROR "map\[\*int\]\*int literal does not escape$"
889
+ m := map [* int ]* int {nil : x } // ERROR "map\[\*int\]\*int{...} does not escape$"
890
890
return m [nil ]
891
891
}
892
892
893
893
func foo111 (x * int ) * int { // ERROR "leaking param: x to result ~r1 level=0"
894
- m := []* int {x } // ERROR "\[\]\*int literal does not escape$"
894
+ m := []* int {x } // ERROR "\[\]\*int{...} does not escape$"
895
895
return m [0 ]
896
896
}
897
897
@@ -906,7 +906,7 @@ func foo113(x *int) *int { // ERROR "leaking param: x to result ~r1 level=0$"
906
906
}
907
907
908
908
func foo114 (x * int ) * int { // ERROR "leaking param: x to result ~r1 level=0$"
909
- m := & Bar {ii : x } // ERROR "&Bar literal does not escape$"
909
+ m := & Bar {ii : x } // ERROR "&Bar{...} does not escape$"
910
910
return m .ii
911
911
}
912
912
@@ -1343,8 +1343,8 @@ func foo140() interface{} {
1343
1343
X string
1344
1344
T * T
1345
1345
}
1346
- t := & T {} // ERROR "&T literal escapes to heap$"
1347
- return U { // ERROR "U literal escapes to heap$"
1346
+ t := & T {} // ERROR "&T{} escapes to heap$"
1347
+ return U { // ERROR "U{...} escapes to heap$"
1348
1348
X : t .X ,
1349
1349
T : t ,
1350
1350
}
@@ -1530,7 +1530,7 @@ type V struct {
1530
1530
}
1531
1531
1532
1532
func NewV (u U ) * V { // ERROR "leaking param: u$"
1533
- return & V {u .String ()} // ERROR "&V literal escapes to heap$"
1533
+ return & V {u .String ()} // ERROR "&V{...} escapes to heap$"
1534
1534
}
1535
1535
1536
1536
func foo152 () {
@@ -1571,21 +1571,21 @@ type Lit struct {
1571
1571
func ptrlitNoescape () {
1572
1572
// Both literal and element do not escape.
1573
1573
i := 0
1574
- x := & Lit {& i } // ERROR "&Lit literal does not escape$"
1574
+ x := & Lit {& i } // ERROR "&Lit{...} does not escape$"
1575
1575
_ = x
1576
1576
}
1577
1577
1578
1578
func ptrlitNoEscape2 () {
1579
1579
// Literal does not escape, but element does.
1580
1580
i := 0 // ERROR "moved to heap: i$"
1581
- x := & Lit {& i } // ERROR "&Lit literal does not escape$"
1581
+ x := & Lit {& i } // ERROR "&Lit{...} does not escape$"
1582
1582
sink = * x
1583
1583
}
1584
1584
1585
1585
func ptrlitEscape () {
1586
1586
// Both literal and element escape.
1587
1587
i := 0 // ERROR "moved to heap: i$"
1588
- x := & Lit {& i } // ERROR "&Lit literal escapes to heap$"
1588
+ x := & Lit {& i } // ERROR "&Lit{...} escapes to heap$"
1589
1589
sink = x
1590
1590
}
1591
1591
@@ -1760,18 +1760,18 @@ func stringtoslicerune2() {
1760
1760
}
1761
1761
1762
1762
func slicerunetostring0 () {
1763
- r := []rune {1 , 2 , 3 } // ERROR "\[\]rune literal does not escape$"
1763
+ r := []rune {1 , 2 , 3 } // ERROR "\[\]rune{...} does not escape$"
1764
1764
s := string (r ) // ERROR "string\(r\) does not escape$"
1765
1765
_ = s
1766
1766
}
1767
1767
1768
1768
func slicerunetostring1 () string {
1769
- r := []rune {1 , 2 , 3 } // ERROR "\[\]rune literal does not escape$"
1769
+ r := []rune {1 , 2 , 3 } // ERROR "\[\]rune{...} does not escape$"
1770
1770
return string (r ) // ERROR "string\(r\) escapes to heap$"
1771
1771
}
1772
1772
1773
1773
func slicerunetostring2 () {
1774
- r := []rune {1 , 2 , 3 } // ERROR "\[\]rune literal does not escape$"
1774
+ r := []rune {1 , 2 , 3 } // ERROR "\[\]rune{...} does not escape$"
1775
1775
sink = string (r ) // ERROR "string\(r\) escapes to heap$"
1776
1776
}
1777
1777
0 commit comments