src/internal/runtime/maps/export_swiss_test.go
raw| 1 | // Copyright 2024 The Go Authors. All rights reserved. |
| 2 | // Use of this source code is governed by a BSD-style |
| 3 | // license that can be found in the LICENSE file. |
| 4 | |
| 5 | //go:build goexperiment.swissmap |
| 6 | |
| 7 | package maps |
| 8 | |
| 9 | import ( |
| 10 | "internal/abi" |
| 11 | "unsafe" |
| 12 | ) |
| 13 | |
| 14 | func newTestMapType[K comparable, V any]() *abi.SwissMapType { |
| 15 | var m map[K]V |
| 16 | mTyp := abi.TypeOf(m) |
| 17 | mt := (*abi.SwissMapType)(unsafe.Pointer(mTyp)) |
| 18 | return mt |
| 19 | } |