aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorKeith Randall <khr@golang.org>2020-08-27 14:05:52 -0700
committerDmitri Shuralyov <dmitshur@golang.org>2020-10-09 17:25:25 +0000
commit46a6fd080635001d7f9fbd8118094f0aa21661a0 (patch)
tree1ee19dec0751fc9bf195440fa06bdcb781a3a2fa /test
parent96983721d42e9e238ea9fec720849ab7bb616122 (diff)
downloadgo-46a6fd080635001d7f9fbd8118094f0aa21661a0.tar.gz
go-46a6fd080635001d7f9fbd8118094f0aa21661a0.zip
[release-branch.go1.15] cmd/compile: make go:notinheap error message friendlier for cgo
Update #40954 Change-Id: Ifaab7349631ccb12fc892882bbdf7f0ebf3d845f Reviewed-on: https://go-review.googlesource.com/c/go/+/251158 Run-TryBot: Keith Randall <khr@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org> TryBot-Result: Go Bot <gobot@golang.org> Trust: Keith Randall <khr@golang.org> Reviewed-on: https://go-review.googlesource.com/c/go/+/255338 Reviewed-by: Austin Clements <austin@google.com>
Diffstat (limited to 'test')
-rw-r--r--test/notinheap.go14
-rw-r--r--test/notinheap2.go14
2 files changed, 14 insertions, 14 deletions
diff --git a/test/notinheap.go b/test/notinheap.go
index a2284a50689..5dd4997a657 100644
--- a/test/notinheap.go
+++ b/test/notinheap.go
@@ -23,11 +23,11 @@ type embed3 struct { // ERROR "must be go:notinheap"
x [1]nih
}
-type embed4 map[nih]int // ERROR "go:notinheap map key not allowed"
+type embed4 map[nih]int // ERROR "incomplete \(or unallocatable\) map key not allowed"
-type embed5 map[int]nih // ERROR "go:notinheap map value not allowed"
+type embed5 map[int]nih // ERROR "incomplete \(or unallocatable\) map value not allowed"
-type emebd6 chan nih // ERROR "chan of go:notinheap type not allowed"
+type emebd6 chan nih // ERROR "chan of incomplete \(or unallocatable\) type not allowed"
type okay1 *nih
@@ -64,8 +64,8 @@ var sink interface{}
func i() {
sink = new(t1) // no error
- sink = (*t2)(new(t1)) // ERROR "cannot convert(.|\n)*t2 is go:notinheap"
- sink = (*t2)(new(struct{ x int })) // ERROR "cannot convert(.|\n)*t2 is go:notinheap"
- sink = []t3("foo") // ERROR "cannot convert(.|\n)*t3 is go:notinheap"
- sink = []t4("bar") // ERROR "cannot convert(.|\n)*t4 is go:notinheap"
+ sink = (*t2)(new(t1)) // ERROR "cannot convert(.|\n)*t2 is incomplete \(or unallocatable\)"
+ sink = (*t2)(new(struct{ x int })) // ERROR "cannot convert(.|\n)*t2 is incomplete \(or unallocatable\)"
+ sink = []t3("foo") // ERROR "cannot convert(.|\n)*t3 is incomplete \(or unallocatable\)"
+ sink = []t4("bar") // ERROR "cannot convert(.|\n)*t4 is incomplete \(or unallocatable\)"
}
diff --git a/test/notinheap2.go b/test/notinheap2.go
index 09d0fc0b7b6..23d4b0ae774 100644
--- a/test/notinheap2.go
+++ b/test/notinheap2.go
@@ -20,7 +20,7 @@ var x nih
// Stack variables are not okay.
func f() {
- var y nih // ERROR "nih is go:notinheap; stack allocation disallowed"
+ var y nih // ERROR "nih is incomplete \(or unallocatable\); stack allocation disallowed"
x = y
}
@@ -34,13 +34,13 @@ var w []nih
var n int
func g() {
- y = new(nih) // ERROR "heap allocation disallowed"
- y2 = new(struct{ x nih }) // ERROR "heap allocation disallowed"
- y3 = new([1]nih) // ERROR "heap allocation disallowed"
- z = make([]nih, 1) // ERROR "heap allocation disallowed"
- z = append(z, x) // ERROR "heap allocation disallowed"
+ y = new(nih) // ERROR "can't be allocated in Go"
+ y2 = new(struct{ x nih }) // ERROR "can't be allocated in Go"
+ y3 = new([1]nih) // ERROR "can't be allocated in Go"
+ z = make([]nih, 1) // ERROR "can't be allocated in Go"
+ z = append(z, x) // ERROR "can't be allocated in Go"
// Test for special case of OMAKESLICECOPY
- x := make([]nih, n) // ERROR "heap allocation disallowed"
+ x := make([]nih, n) // ERROR "can't be allocated in Go"
copy(x, z)
z = x
}