mirror of
				https://github.com/rust-lang/rust.git
				synced 2025-10-31 04:57:19 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			39 lines
		
	
	
		
			614 B
		
	
	
	
		
			Rust
		
	
	
	
	
	
			
		
		
	
	
			39 lines
		
	
	
		
			614 B
		
	
	
	
		
			Rust
		
	
	
	
	
	
| //@ edition: 2021
 | |
| 
 | |
| // Test doesn't fail until monomorphization time, unfortunately.
 | |
| //@ build-fail
 | |
| 
 | |
| fn main() {
 | |
|     let _ = async {
 | |
|         A.first().await.second().await;
 | |
|     };
 | |
| }
 | |
| 
 | |
| pub trait First {
 | |
|     type Second: Second;
 | |
|     async fn first(self) -> Self::Second;
 | |
| }
 | |
| 
 | |
| struct A;
 | |
| 
 | |
| impl First for A {
 | |
|     type Second = A;
 | |
|     async fn first(self) -> Self::Second {
 | |
|         A
 | |
|     }
 | |
| }
 | |
| 
 | |
| pub trait Second {
 | |
|     async fn second(self);
 | |
| }
 | |
| 
 | |
| impl<C> Second for C
 | |
| where
 | |
|     C: First,
 | |
| {
 | |
|     async fn second(self) {
 | |
|         //~^ ERROR recursion in an async fn requires boxing
 | |
|         self.first().await.second().await;
 | |
|     }
 | |
| }
 | 
