From 010e5b9aa86b8a303683046f2ebd0357a52f157a Mon Sep 17 00:00:00 2001 From: Nick Fitzgerald Date: Fri, 18 Sep 2020 11:33:38 -0700 Subject: [PATCH] Make filetest errors report full context (#2207) * clif-util: do not convert `anyhow::Error`s into strings into `anyhow::Error`s * filetests: Use the debug formatting of `anyhow::Error`s This provides the full error context, not just the source error's message. --- cranelift/filetests/src/runner.rs | 2 +- cranelift/src/clif-util.rs | 6 ++---- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/cranelift/filetests/src/runner.rs b/cranelift/filetests/src/runner.rs index e7877cdb4c..d3fa759537 100644 --- a/cranelift/filetests/src/runner.rs +++ b/cranelift/filetests/src/runner.rs @@ -48,7 +48,7 @@ impl Display for QueueEntry { let p = self.path.to_string_lossy(); match self.state { State::Done(Ok(dur)) => write!(f, "{}.{:03} {}", dur.as_secs(), dur.subsec_millis(), p), - State::Done(Err(ref e)) => write!(f, "FAIL {}: {}", p, e), + State::Done(Err(ref e)) => write!(f, "FAIL {}: {:?}", p, e), _ => write!(f, "{}", p), } } diff --git a/cranelift/src/clif-util.rs b/cranelift/src/clif-util.rs index 01e2e4e9aa..7904ffeb43 100644 --- a/cranelift/src/clif-util.rs +++ b/cranelift/src/clif-util.rs @@ -161,8 +161,7 @@ fn main() -> anyhow::Result<()> { .iter() .map(|f| f.display().to_string()) .collect::>(), - ) - .map_err(|s| anyhow::anyhow!("{}", s))?; + )?; } Commands::Pass(p) => { handle_debug_flag(p.debug); @@ -172,8 +171,7 @@ fn main() -> anyhow::Result<()> { &p.passes, &p.target, &p.file.display().to_string(), - ) - .map_err(|s| anyhow::anyhow!("{}", s))?; + )?; } }