]> git.proxmox.com Git - rustc.git/blob - tests/ui/traits/issue-72455.rs
New upstream version 1.68.2+dfsg1
[rustc.git] / tests / ui / traits / issue-72455.rs
1 // check-pass
2
3 pub trait ResultExt {
4 type Ok;
5 fn err_eprint_and_ignore(self) -> Option<Self::Ok>;
6 }
7
8 impl<O, E> ResultExt for std::result::Result<O, E>
9 where
10 E: std::error::Error,
11 {
12 type Ok = O;
13 fn err_eprint_and_ignore(self) -> Option<O>
14 where
15 Self: ,
16 {
17 match self {
18 Err(e) => {
19 eprintln!("{}", e);
20 None
21 }
22 Ok(o) => Some(o),
23 }
24 }
25 }
26
27 fn main() {}