runtime: replace mentions of "raised" with "panicked"

Fixes #73526

Change-Id: I4b801cf3e54b99559e6d5ca8fdb2fd0692a0d3a5
Reviewed-on: https://go-review.googlesource.com/c/go/+/669975
TryBot-Bypass: Mark Freeman <mark@golang.org>
Reviewed-by: Robert Griesemer <gri@google.com>
Auto-Submit: Mark Freeman <mark@golang.org>
Reviewed-by: Mark Freeman <mark@golang.org>
This commit is contained in:
Mark Freeman 2025-05-05 12:33:46 -04:00 committed by Gopher Robot
parent 92e23b683f
commit d365f2266d
7 changed files with 27 additions and 27 deletions

View file

@ -3,11 +3,11 @@
<!-- go.dev/issue/71517 --> <!-- go.dev/issue/71517 -->
The message printed when a program exits due to an unhandled panic The message printed when a program exits due to an unhandled panic
that was recovered and re-raised no longer repeats the text of that was recovered and repanicked no longer repeats the text of
the panic value. the panic value.
Previously, a program which panicked with `panic("PANIC")`, Previously, a program which panicked with `panic("PANIC")`,
recovered the panic, and then re-panicked with the original recovered the panic, and then repanicked with the original
value would print: value would print:
panic: PANIC [recovered] panic: PANIC [recovered]
@ -15,7 +15,7 @@ value would print:
This program will now print: This program will now print:
panic: PANIC [recovered, reraised] panic: PANIC [recovered, repanicked]
<!-- go.dev/issue/71546 --> <!-- go.dev/issue/71546 -->

View file

@ -14,8 +14,8 @@ env GOGC=off
! go test -v cleanup_failnow/panic_nocleanup_test.go ! go test -v cleanup_failnow/panic_nocleanup_test.go
! stdout 'no tests to run' ! stdout 'no tests to run'
stdout '(?s)panic: die \[recovered, reraised\]' stdout '(?s)panic: die \[recovered, repanicked\]'
! stdout '(?s)panic: die \[recovered, reraised\].*panic: die' ! stdout '(?s)panic: die \[recovered, repanicked\].*panic: die'
! go test -v cleanup_failnow/panic_withcleanup_test.go ! go test -v cleanup_failnow/panic_withcleanup_test.go
! stdout 'no tests to run' ! stdout 'no tests to run'

View file

@ -3,7 +3,7 @@
# Disable vet, as its "tests" analyzer would report the same problem statically. # Disable vet, as its "tests" analyzer would report the same problem statically.
! go test -vet=off . ! go test -vet=off .
stdout '^panic: testing: fuzz target must not return a value \[recovered, reraised\]$' stdout '^panic: testing: fuzz target must not return a value \[recovered, repanicked\]$'
-- go.mod -- -- go.mod --
module test module test

View file

@ -357,19 +357,19 @@ panic: third panic
} }
func TestReraisedPanic(t *testing.T) { func TestRepanickedPanic(t *testing.T) {
output := runTestProg(t, "testprog", "ReraisedPanic") output := runTestProg(t, "testprog", "RepanickedPanic")
want := `panic: message [recovered, reraised] want := `panic: message [recovered, repanicked]
` `
if !strings.HasPrefix(output, want) { if !strings.HasPrefix(output, want) {
t.Fatalf("output does not start with %q:\n%s", want, output) t.Fatalf("output does not start with %q:\n%s", want, output)
} }
} }
func TestReraisedMiddlePanic(t *testing.T) { func TestRepanickedMiddlePanic(t *testing.T) {
output := runTestProg(t, "testprog", "ReraisedMiddlePanic") output := runTestProg(t, "testprog", "RepanickedMiddlePanic")
want := `panic: inner [recovered] want := `panic: inner [recovered]
panic: middle [recovered, reraised] panic: middle [recovered, repanicked]
panic: outer panic: outer
` `
if !strings.HasPrefix(output, want) { if !strings.HasPrefix(output, want) {
@ -377,8 +377,8 @@ func TestReraisedMiddlePanic(t *testing.T) {
} }
} }
func TestReraisedPanicSandwich(t *testing.T) { func TestRepanickedPanicSandwich(t *testing.T) {
output := runTestProg(t, "testprog", "ReraisedPanicSandwich") output := runTestProg(t, "testprog", "RepanickedPanicSandwich")
want := `panic: outer [recovered] want := `panic: outer [recovered]
panic: inner [recovered] panic: inner [recovered]
panic: outer panic: outer

View file

@ -635,8 +635,8 @@ func preprintpanics(p *_panic) {
for p != nil { for p != nil {
if p.link != nil && *efaceOf(&p.link.arg) == *efaceOf(&p.arg) { if p.link != nil && *efaceOf(&p.link.arg) == *efaceOf(&p.arg) {
// This panic contains the same value as the next one in the chain. // This panic contains the same value as the next one in the chain.
// Mark it as reraised. We will skip printing it twice in a row. // Mark it as repanicked. We will skip printing it twice in a row.
p.link.reraised = true p.link.repanicked = true
p = p.link p = p.link
continue continue
} }
@ -655,7 +655,7 @@ func preprintpanics(p *_panic) {
func printpanics(p *_panic) { func printpanics(p *_panic) {
if p.link != nil { if p.link != nil {
printpanics(p.link) printpanics(p.link)
if p.link.reraised { if p.link.repanicked {
return return
} }
if !p.link.goexit { if !p.link.goexit {
@ -667,8 +667,8 @@ func printpanics(p *_panic) {
} }
print("panic: ") print("panic: ")
printpanicval(p.arg) printpanicval(p.arg)
if p.reraised { if p.repanicked {
print(" [recovered, reraised]") print(" [recovered, repanicked]")
} else if p.recovered { } else if p.recovered {
print(" [recovered]") print(" [recovered]")
} }

View file

@ -1013,7 +1013,7 @@ type _panic struct {
slotsPtr unsafe.Pointer slotsPtr unsafe.Pointer
recovered bool // whether this panic has been recovered recovered bool // whether this panic has been recovered
reraised bool // whether this panic was reraised repanicked bool // whether this panic repanicked
goexit bool goexit bool
deferreturn bool deferreturn bool
} }

View file

@ -19,9 +19,9 @@ func init() {
register("StringPanic", StringPanic) register("StringPanic", StringPanic)
register("NilPanic", NilPanic) register("NilPanic", NilPanic)
register("CircularPanic", CircularPanic) register("CircularPanic", CircularPanic)
register("ReraisedPanic", ReraisedPanic) register("RepanickedPanic", RepanickedPanic)
register("ReraisedMiddlePanic", ReraisedMiddlePanic) register("RepanickedMiddlePanic", RepanickedMiddlePanic)
register("ReraisedPanicSandwich", ReraisedPanicSandwich) register("RepanickedPanicSandwich", RepanickedPanicSandwich)
} }
func test(name string) { func test(name string) {
@ -141,14 +141,14 @@ func CircularPanic() {
panic(exampleCircleStartError{}) panic(exampleCircleStartError{})
} }
func ReraisedPanic() { func RepanickedPanic() {
defer func() { defer func() {
panic(recover()) panic(recover())
}() }()
panic("message") panic("message")
} }
func ReraisedMiddlePanic() { func RepanickedMiddlePanic() {
defer func() { defer func() {
recover() recover()
panic("outer") panic("outer")
@ -173,9 +173,9 @@ func ReraisedMiddlePanic() {
// recovered, panic("inner") => // recovered, panic("inner") =>
// panic(recovered outer panic value) // panic(recovered outer panic value)
// //
// Exercises the edge case where we reraise a panic value, // Exercises the edge case where we repanic a panic value,
// but with another panic in the middle. // but with another panic in the middle.
func ReraisedPanicSandwich() { func RepanickedPanicSandwich() {
var outer any var outer any
defer func() { defer func() {
recover() recover()