mirror of
				https://github.com/rust-lang/rust.git
				synced 2025-11-04 06:56:14 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			13 lines
		
	
	
		
			233 B
		
	
	
	
		
			Rust
		
	
	
	
	
	
			
		
		
	
	
			13 lines
		
	
	
		
			233 B
		
	
	
	
		
			Rust
		
	
	
	
	
	
struct Foo<'a> {
 | 
						|
    x: Option<&'a u32>,
 | 
						|
}
 | 
						|
 | 
						|
fn main() {
 | 
						|
    let mut x = Foo { x: None };
 | 
						|
    let y = 0;
 | 
						|
    x.x = Some(&y);
 | 
						|
    //~^ ERROR `y` does not live long enough [E0597]
 | 
						|
}
 | 
						|
 | 
						|
impl<'a> Drop for Foo<'a> { fn drop(&mut self) { } }
 |