mirror of
				https://github.com/rust-lang/rust.git
				synced 2025-10-31 21:16:44 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			24 lines
		
	
	
		
			427 B
		
	
	
	
		
			Rust
		
	
	
	
	
	
			
		
		
	
	
			24 lines
		
	
	
		
			427 B
		
	
	
	
		
			Rust
		
	
	
	
	
	
| struct QualifiedError<E>(E);
 | |
| 
 | |
| impl<E, T> From<E> for QualifiedError<T>
 | |
| where
 | |
|     E: std::error::Error,
 | |
|     T: From<E>,
 | |
| {
 | |
|     fn from(e: E) -> QualifiedError<T> {
 | |
|         QualifiedError(e.into())
 | |
|     }
 | |
| }
 | |
| 
 | |
| fn infallible() -> Result<(), std::convert::Infallible> {
 | |
|     Ok(())
 | |
| }
 | |
| 
 | |
| fn main() {
 | |
|     let x = || -> Result<_, QualifiedError<_>> {
 | |
|         infallible()?;
 | |
|         Ok(())
 | |
|         //~^ ERROR type annotations needed
 | |
|     };
 | |
| }
 | 
