trait

RefUnwindSafe — shared access across unwind

This helper marker is relevant to shared references crossing panic boundaries. Interior-mutability primitives can permit changes through shared references and do not generally satisfy this marker. Expected stdout (not executed): bound satisfied Common mistake: Equating shared access with guaranteed panic-safe state.

Formal Syntax & Structure

rust syntaxrust
pub auto trait RefUnwindSafe {}

Working Example

Example Snippetrust
fn main() {    fn check<T: std::panic::RefUnwindSafe>(_: &T) { println!("bound satisfied"); }    check(&12i32);}
Rust Reference