Update to go1.24.0

This commit is contained in:
Vorapol Rinsatitnon
2025-02-14 12:42:07 +07:00
parent 25e497e367
commit bf266cebe6
3169 changed files with 236789 additions and 60275 deletions

View File

@@ -4,12 +4,15 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Test type-checking errors for go:notinheap.
// Test type-checking errors for not-in-heap types.
//go:build cgo
package p
//go:notinheap
type nih struct{}
import "runtime/cgo"
type nih struct{ _ cgo.Incomplete }
type embed4 map[nih]int // ERROR "incomplete \(or unallocatable\) map key not allowed"
@@ -27,25 +30,8 @@ type okay4 interface {
f(x nih) nih
}
// Type conversions don't let you sneak past notinheap.
type t1 struct{ x int }
//go:notinheap
type t2 t1
//go:notinheap
type t3 byte
//go:notinheap
type t4 rune
var sink interface{}
func i() {
sink = new(t1) // no error
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\)"
func f() {
type embed7 map[nih]int // ERROR "incomplete \(or unallocatable\) map key not allowed"
type embed8 map[int]nih // ERROR "incomplete \(or unallocatable\) map value not allowed"
type emebd9 chan nih // ERROR "chan of incomplete \(or unallocatable\) type not allowed"
}