mirror of
				https://github.com/rust-lang/rust.git
				synced 2025-11-04 06:56:14 +00:00 
			
		
		
		
	Also allow `impl Trait` in delegated functions. The delegation item will refer to the original opaque type from the callee, fresh opaque type won't be created.
		
			
				
	
	
		
			28 lines
		
	
	
		
			356 B
		
	
	
	
		
			Rust
		
	
	
	
	
	
			
		
		
	
	
			28 lines
		
	
	
		
			356 B
		
	
	
	
		
			Rust
		
	
	
	
	
	
//@ check-pass
 | 
						|
 | 
						|
#![feature(fn_delegation)]
 | 
						|
#![allow(incomplete_features)]
 | 
						|
 | 
						|
mod to_reuse {
 | 
						|
    pub fn foo() -> impl Clone { 0 }
 | 
						|
}
 | 
						|
 | 
						|
reuse to_reuse::foo;
 | 
						|
 | 
						|
trait Trait {
 | 
						|
    fn bar() -> impl Clone { 1 }
 | 
						|
}
 | 
						|
 | 
						|
struct S;
 | 
						|
impl Trait for S {}
 | 
						|
 | 
						|
impl S {
 | 
						|
    reuse to_reuse::foo;
 | 
						|
    reuse <S as Trait>::bar;
 | 
						|
}
 | 
						|
 | 
						|
fn main() {
 | 
						|
    foo().clone();
 | 
						|
    <S>::bar().clone();
 | 
						|
}
 |