about summary refs log tree commit diff
path: root/tests/ui/traits/issue-72455.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/traits/issue-72455.rs')
-rw-r--r--tests/ui/traits/issue-72455.rs27
1 files changed, 27 insertions, 0 deletions
diff --git a/tests/ui/traits/issue-72455.rs b/tests/ui/traits/issue-72455.rs
new file mode 100644
index 00000000000..b6c3bb22287
--- /dev/null
+++ b/tests/ui/traits/issue-72455.rs
@@ -0,0 +1,27 @@
+// check-pass
+
+pub trait ResultExt {
+    type Ok;
+    fn err_eprint_and_ignore(self) -> Option<Self::Ok>;
+}
+
+impl<O, E> ResultExt for std::result::Result<O, E>
+where
+    E: std::error::Error,
+{
+    type Ok = O;
+    fn err_eprint_and_ignore(self) -> Option<O>
+    where
+        Self: ,
+    {
+        match self {
+            Err(e) => {
+                eprintln!("{}", e);
+                None
+            }
+            Ok(o) => Some(o),
+        }
+    }
+}
+
+fn main() {}