1// Copyright 2023 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 5package runtime_test 6 7import ( 8 "testing" 9 _ "unsafe" 10) 11 12//go:linkname heapObjectsCanMove runtime.heapObjectsCanMove 13func heapObjectsCanMove() bool 14 15func TestHeapObjectsCanMove(t *testing.T) { 16 if heapObjectsCanMove() { 17 // If this happens (or this test stops building), 18 // it will break go4.org/unsafe/assume-no-moving-gc. 19 t.Fatalf("heap objects can move!") 20 } 21} 22