Expand description
Go panics, carried on Rust unwinding.
A Go panic becomes a Rust unwind whose payload is a GoPanic. Runtime
errors (division by zero, bounds, nil dereference, …) use the same payload
with gc’s exact text, because programs and tests match on it.
For now the payload holds only the text gc prints after panic: . From M1,
when interfaces exist, it carries the panic value as an any, so recover
can hand it back and runtime errors satisfy runtime.Error.
Structs§
- GoPanic
- Payload of a Rust unwind that implements a Go panic: the value
recoverhands back, and the text gc prints afterpanic:.
Enums§
- Runtime
Error - The runtime errors generated code can raise.
Functions§
- begin
- Takes over a caught panic so the deferred calls can
recoverit. - go_
panic - Starts a Go panic.
- init_
runtime_ errors - Teaches the runtime the ids of
Error() stringandString() string, so a recovered runtime error satisfieserrorlike gc’s does. Generatedmaincalls this before anything else. - panic_
custom panic(v)for a value of a named type with a predeclared underlying type, printed as gc’sprintanycustomtypedoes:main.T(5),main.S("x").- panic_
iface panic(v)where the value is an interface: its type descriptor knows how gc prints it (anerrorprintsError(), a named basic type printsmain.T(v), and so on).- panic_
nil panic(nil).- panic_
value panic(v)for a value of a predeclared type, printed as gc’sprintpanicvaldoes: likeprint, with newlines in strings followed by a tab.- recover
recover(): the value of the panic being handled, and an end to it.- recovered
- Whether the panic being handled was recovered.
- resume
- Carries on unwinding with the panic being handled.
- runtime_
error - Raises a Go runtime error.