]> git.lizzy.rs Git - rust.git/blobdiff - tests/ui/match_as_ref.fixed
Auto merge of #8374 - Alexendoo:bless-revisions, r=camsteffen
[rust.git] / tests / ui / match_as_ref.fixed
index 75085367f961f39d7945d80faeef0cf05f1adff2..c61eb9216643e14159ca5d6fb26b93764b05e264 100644 (file)
@@ -11,4 +11,25 @@ fn match_as_ref() {
     let borrow_mut: Option<&mut ()> = mut_owned.as_mut();
 }
 
+mod issue4437 {
+    use std::{error::Error, fmt, num::ParseIntError};
+
+    #[derive(Debug)]
+    struct E {
+        source: Option<ParseIntError>,
+    }
+
+    impl Error for E {
+        fn source(&self) -> Option<&(dyn Error + 'static)> {
+            self.source.as_ref().map(|x| x as _)
+        }
+    }
+
+    impl fmt::Display for E {
+        fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
+            unimplemented!()
+        }
+    }
+}
+
 fn main() {}