std1.0.0-beta-7 SafeC docs

std :: panic

Function std::expect_ref

#include <std/panic.h> source

generic<T> &T expect_ref(?&T r, const &char msg)

Checked narrowing of a nullable reference: returns 'r' as '&T', or panics with 'msg' if it is null. The explicit form of "this can't be null here" — a cast '(&T)r' is rejected because it would skip the check. For recoverable absence, 'match (r) { case null: ... case some(x): ... }'.