Skip to content

Commit 47e35cb

Browse files
committed
Add test for #72455
1 parent 58fe05a commit 47e35cb

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

src/test/ui/issues/issue-72455.rs

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
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() {}

0 commit comments

Comments
 (0)