From 22f24f90b52958158a2de5fa68adf0faf7699e4e Mon Sep 17 00:00:00 2001 From: Junyang Shao Date: Thu, 30 Oct 2025 19:14:57 +0000 Subject: cmd/compile: change testing.B.Loop keep alive semantic This CL implements this initial design of testing.B.Loop's keep variable alive semantic: https://github.com/golang/go/issues/61515#issuecomment-2407963248. Fixes #73137. Change-Id: I8060470dbcb0dda0819334f3615cc391ff0f6501 Reviewed-on: https://go-review.googlesource.com/c/go/+/716660 LUCI-TryBot-Result: Go LUCI Reviewed-by: David Chase --- test/inline_testingbloop.go | 37 ------------------------------------- 1 file changed, 37 deletions(-) delete mode 100644 test/inline_testingbloop.go (limited to 'test/inline_testingbloop.go') diff --git a/test/inline_testingbloop.go b/test/inline_testingbloop.go deleted file mode 100644 index 702a652f56..0000000000 --- a/test/inline_testingbloop.go +++ /dev/null @@ -1,37 +0,0 @@ -// errorcheck -0 -m - -// Copyright 2024 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// Test no inlining of function calls in testing.B.Loop. -// See issue #61515. - -package foo - -import "testing" - -func caninline(x int) int { // ERROR "can inline caninline" - return x -} - -func test(b *testing.B) { // ERROR "leaking param: b" - for i := 0; i < b.N; i++ { - caninline(1) // ERROR "inlining call to caninline" - } - for b.Loop() { // ERROR "skip inlining within testing.B.loop" "inlining call to testing\.\(\*B\)\.Loop" - caninline(1) - } - for i := 0; i < b.N; i++ { - caninline(1) // ERROR "inlining call to caninline" - } - for b.Loop() { // ERROR "skip inlining within testing.B.loop" "inlining call to testing\.\(\*B\)\.Loop" - caninline(1) - } - for i := 0; i < b.N; i++ { - caninline(1) // ERROR "inlining call to caninline" - } - for b.Loop() { // ERROR "skip inlining within testing.B.loop" "inlining call to testing\.\(\*B\)\.Loop" - caninline(1) - } -} -- cgit v1.3-5-g9baa