diff --git a/src/lib.rs b/src/lib.rs index ec941ea52..94d5a7b48 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,12 +1,13 @@ // Copyright © 2025 Cyberus Technology GmbH // // SPDX-License-Identifier: Apache-2.0 -// + +use std::error::Error; /// Prints a chain of errors to the user in a consistent manner. /// The user will see a clear chain of errors, followed by debug output /// for opening issues. -pub fn cli_print_error_chain(top_error: &dyn std::error::Error, component: &str) { +pub fn cli_print_error_chain(top_error: &dyn Error, component: &str) { eprint!("Error: {component} exited with the following "); if top_error.source().is_none() { eprintln!("error:"); @@ -14,7 +15,9 @@ pub fn cli_print_error_chain(top_error: &dyn std::error::Error, component: &str) } else { eprintln!("chain of errors:"); std::iter::successors(Some(top_error), |sub_error| { - sub_error.source() + // Dereference necessary to mitigate rustc compiler bug. + // See + (*sub_error).source() }) .enumerate() .for_each(|(level, error)| {