compiler: add support for new unsafe slice/string functions

This adds support for unsafe.SliceData, unsafe.String, and
unsafe.SringData that were introduced in Go 1.20.
This commit is contained in:
Ayke van Laethem
2023-01-13 17:52:18 +00:00
committed by Ron Evans
parent 33489d6344
commit c43958972c
6 changed files with 120 additions and 21 deletions
+4 -3
View File
@@ -143,10 +143,11 @@ func sliceToArrayPointerPanic() {
runtimePanic("slice smaller than array")
}
// Panic when calling unsafe.Slice() (Go 1.17+) with a len that's too large
// (which includes if the ptr is nil and len is nonzero).
// Panic when calling unsafe.Slice() (Go 1.17+) or unsafe.String() (Go 1.20+)
// with a len that's too large (which includes if the ptr is nil and len is
// nonzero).
func unsafeSlicePanic() {
runtimePanic("unsafe.Slice: len out of range")
runtimePanic("unsafe.Slice/String: len out of range")
}
// Panic when trying to create a new channel that is too big.