blob: 92b0b59788104597e27030f8e2df0928b9c340f7 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
// check-pass
// compile-flags: -Znext-solver
use std::error::Error;
fn main() -> Result<(), Box<dyn Error>> {
let x: i32 = parse()?;
Ok(())
}
trait Parse {}
impl Parse for i32 {}
#[derive(Debug)]
struct ParseError;
impl std::fmt::Display for ParseError {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "ParseError")
}
}
impl Error for ParseError {}
fn parse<T: Parse>() -> Result<T, ParseError> {
todo!()
}
|