// This test asserts that errors can be used across threads. use std::thread; use snafu::prelude::*; #[derive(Debug, Snafu)] enum InnerError { Boom, } #[derive(Debug, Snafu)] enum Error { _Leaf { name: String, }, Wrapper { source: InnerError, }, _BoxedWrapper { source: Box, }, _BoxedTraitObjectSend { source: Box, }, _BoxedTraitObjectSendSync { source: Box, }, } fn example() -> Result<(), Error> { BoomSnafu.fail().context(WrapperSnafu) } #[test] fn implements_thread_safe_error() { fn check_error() {} check_error::(); check_error::(); fn check_send() {} check_send::(); check_send::(); let t = thread::spawn(move || example()); let v = t.join().expect("Thread panicked"); v.unwrap_err(); }