mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
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>
This commit is contained in:
parent
42b023d7b9
commit
37f261010f
6 changed files with 24 additions and 24 deletions
|
|
@ -648,7 +648,7 @@ opswitch:
|
|||
// x = append(...)
|
||||
r := n.Right
|
||||
if r.Type.Elem().NotInHeap() {
|
||||
yyerror("%v is go:notinheap; heap allocation disallowed", r.Type.Elem())
|
||||
yyerror("%v can't be allocated in Go; it is incomplete (or unallocatable)", r.Type.Elem())
|
||||
}
|
||||
switch {
|
||||
case isAppendOfMake(r):
|
||||
|
|
@ -1164,7 +1164,7 @@ opswitch:
|
|||
|
||||
case ONEW:
|
||||
if n.Type.Elem().NotInHeap() {
|
||||
yyerror("%v is go:notinheap; heap allocation disallowed", n.Type.Elem())
|
||||
yyerror("%v can't be allocated in Go; it is incomplete (or unallocatable)", n.Type.Elem())
|
||||
}
|
||||
if n.Esc == EscNone {
|
||||
if n.Type.Elem().Width >= maxImplicitStackVarSize {
|
||||
|
|
@ -1335,7 +1335,7 @@ opswitch:
|
|||
}
|
||||
t := n.Type
|
||||
if t.Elem().NotInHeap() {
|
||||
yyerror("%v is go:notinheap; heap allocation disallowed", t.Elem())
|
||||
yyerror("%v can't be allocated in Go; it is incomplete (or unallocatable)", t.Elem())
|
||||
}
|
||||
if n.Esc == EscNone {
|
||||
if !isSmallMakeSlice(n) {
|
||||
|
|
@ -1412,7 +1412,7 @@ opswitch:
|
|||
|
||||
t := n.Type
|
||||
if t.Elem().NotInHeap() {
|
||||
yyerror("%v is go:notinheap; heap allocation disallowed", t.Elem())
|
||||
yyerror("%v can't be allocated in Go; it is incomplete (or unallocatable)", t.Elem())
|
||||
}
|
||||
|
||||
length := conv(n.Left, types.Types[TINT])
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue