mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
cmd/compile: implement slice-to-array conversions
The conversion T(x) is implemented as *(*T)(x). Accordingly, runtime panic messages for (*T)(x) are made more general. Fixes #46505. Change-Id: I76317c0878b6a5908299506d392eed50d7ef6523 Reviewed-on: https://go-review.googlesource.com/c/go/+/430415 Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com> Reviewed-by: Jenny Rakoczy <jenny@golang.org> TryBot-Result: Gopher Robot <gobot@golang.org> Run-TryBot: Matthew Dempsky <mdempsky@google.com> Reviewed-by: Keith Randall <khr@golang.org>
This commit is contained in:
parent
29153be757
commit
ceffdc8545
15 changed files with 210 additions and 148 deletions
|
|
@ -197,9 +197,9 @@ func goPanicSlice3CU(x uint, y int) {
|
|||
panic(boundsError{x: int64(x), signed: false, y: y, code: boundsSlice3C})
|
||||
}
|
||||
|
||||
// failures in the conversion (*[x]T)s, 0 <= x <= y, x == cap(s)
|
||||
// failures in the conversion ([x]T)(s) or (*[x]T)(s), 0 <= x <= y, y == len(s)
|
||||
func goPanicSliceConvert(x int, y int) {
|
||||
panicCheck1(getcallerpc(), "slice length too short to convert to pointer to array")
|
||||
panicCheck1(getcallerpc(), "slice length too short to convert to array or pointer to array")
|
||||
panic(boundsError{x: int64(x), signed: true, y: y, code: boundsConvert})
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue