PrimeIntellect/SWE-rebench-V2 huggingface dataset:
Repository: dtolnay/anyhow (rust)

Issue:
Have anyhow::Error implement std::error::Error?
`anyhow::Error` does not implement `std::error::Error`, which leads to confusion when using anyhow with code that expects a `Result<_, std::error::Error>`.

I noticed that the same applies to `failure::Error` in the failure crate.

What is the reason for that? What prevents `anyhow::Error` from implementing `std::error::Error`?

... and thanks for all your awesome Rust crates!

Pull request:
Add From<anyhow::Error> for Box<dyn std::error::Error>
Closes #25.

Patch:
diff --git a/src/error.rs b/src/error.rs
index 196e75a..1723028 100644
--- a/src/error.rs
+++ b/src/error.rs
@@ -572,6 +572,12 @@ impl From<Error> for Box<dyn StdError + Send + Sync + 'static> {
     }
 }
 
+impl From<Error> for Box<dyn StdError + 'static> {
+    fn from(error: Error) -> Self {
+        Box::<dyn StdError + Send + Sync>::from(error)
+    }
+}
+
 /// Iterator of a chain of source errors.
 ///
 /// This type is the iterator returned by [`Error::chain`].


Test patch:
diff --git a/tests/test_convert.rs b/tests/test_convert.rs
index 20be593..25e6136 100644
--- a/tests/test_convert.rs
+++ b/tests/test_convert.rs
@@ -1,7 +1,7 @@
 mod drop;
 
 use self::drop::DetectDrop;
-use anyhow::Error;
+use anyhow::{Error, Result};
 use std::error::Error as StdError;
 use std::sync::atomic::AtomicBool;
 use std::sync::atomic::Ordering::SeqCst;
@@ -16,3 +16,12 @@ fn test_convert() {
     drop(box_dyn);
     assert!(has_dropped.load(SeqCst));
 }
+
+#[test]
+fn test_question_mark() -> Result<(), Box<dyn StdError>> {
+    fn f() -> Result<()> {
+        Ok(())
+    }
+    f()?;
+    Ok(())
+}