#[macro_use] extern crate derive_more; extern crate erroneous; use erroneous::Error; use std::error::Error as _; #[derive(Debug, Display, Error)] #[display(fmt = "SomeError")] struct SomeError; #[derive(Debug, Display, Error)] #[display(fmt = "E")] enum E { A, Custom(#[error(source)] Custom), } #[test] fn main() { let _ = E::A::; let b = E::Custom(SomeError); b.source().unwrap(); }