mirror of
				https://github.com/rust-lang/rust.git
				synced 2025-11-03 22:49:17 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			25 lines
		
	
	
		
			445 B
		
	
	
	
		
			Rust
		
	
	
	
	
	
			
		
		
	
	
			25 lines
		
	
	
		
			445 B
		
	
	
	
		
			Rust
		
	
	
	
	
	
// check-pass
 | 
						|
#![allow(dead_code)]
 | 
						|
// #11612
 | 
						|
// We weren't updating the auto adjustments with all the resolved
 | 
						|
// type information after type check.
 | 
						|
 | 
						|
// pretty-expanded FIXME #23616
 | 
						|
 | 
						|
trait A { fn dummy(&self) { } }
 | 
						|
 | 
						|
struct B<'a, T:'a> {
 | 
						|
    f: &'a T
 | 
						|
}
 | 
						|
 | 
						|
impl<'a, T> A for B<'a, T> {}
 | 
						|
 | 
						|
fn foo(_: &dyn A) {}
 | 
						|
 | 
						|
fn bar<G>(b: &B<G>) {
 | 
						|
    foo(b);       // Coercion should work
 | 
						|
    foo(b as &dyn A); // Explicit cast should work as well
 | 
						|
}
 | 
						|
 | 
						|
fn main() {}
 |