diff --git a/src/handlers/graphical.rs b/src/handlers/graphical.rs index 37b6bf8..f82b1f0 100644 --- a/src/handlers/graphical.rs +++ b/src/handlers/graphical.rs @@ -504,7 +504,10 @@ impl GraphicalReportHandler { let mut inner_renderer = self.clone(); inner_renderer.footer = None; - inner_renderer.with_cause_chain = false; + // Each related error is an independent diagnostic whose cause + // chain has not been flattened, so keep printing it to avoid + // dropping the source chain and its details. + inner_renderer.with_cause_chain = true; inner_renderer.termwidth -= rest_indent.width(); inner_renderer.render_report_inner(&mut inner, rel, src)?; diff --git a/tests/test_diagnostic_source_macro.rs b/tests/test_diagnostic_source_macro.rs index 1349303..a6c3cfb 100644 --- a/tests/test_diagnostic_source_macro.rs +++ b/tests/test_diagnostic_source_macro.rs @@ -345,6 +345,16 @@ fn test_display_related_errors_as_nested() { × A multi-error happened ├─▶ × A multi-error happened │ ├─▶ × A nested error happened + │ │ ├─▶ × TestError + │ │ │ + │ │ ╰─▶ × A complex error happened + │ │ ╭──── + │ │ 1 │ This is another error + │ │ · ──┬─ + │ │ · ╰── here + │ │ ╰──── + │ │ help: You should fix this + │ │ │ │ ╭──── │ │ 1 │ right here │ │ · ──┬─