mirror of
				https://github.com/rust-lang/rust.git
				synced 2025-11-04 06:56:14 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			15 lines
		
	
	
		
			303 B
		
	
	
	
		
			Rust
		
	
	
	
	
	
			
		
		
	
	
			15 lines
		
	
	
		
			303 B
		
	
	
	
		
			Rust
		
	
	
	
	
	
// Test that a covariant struct does not permit the lifetime of a
 | 
						|
// reference to be enlarged.
 | 
						|
 | 
						|
struct SomeStruct<T>(T);
 | 
						|
 | 
						|
fn foo<'min,'max>(v: SomeStruct<&'min ()>)
 | 
						|
                  -> SomeStruct<&'max ()>
 | 
						|
    where 'max : 'min
 | 
						|
{
 | 
						|
    v
 | 
						|
    //~^ ERROR lifetime may not live long enough
 | 
						|
}
 | 
						|
 | 
						|
fn main() { }
 |