mirror of
				https://github.com/rust-lang/rust.git
				synced 2025-10-30 20:44:34 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			16 lines
		
	
	
		
			396 B
		
	
	
	
		
			Rust
		
	
	
	
	
	
			
		
		
	
	
			16 lines
		
	
	
		
			396 B
		
	
	
	
		
			Rust
		
	
	
	
	
	
| //@ aux-build: foreign.rs
 | |
| 
 | |
| extern crate foreign;
 | |
| 
 | |
| fn main() {
 | |
|     let mut x = vec![];
 | |
|     let h = foreign::hello(&x);
 | |
|     //~^ NOTE this call may capture more lifetimes than intended
 | |
|     //~| NOTE immutable borrow occurs here
 | |
|     x.push(0);
 | |
|     //~^ ERROR cannot borrow `x` as mutable
 | |
|     //~| NOTE mutable borrow occurs here
 | |
|     println!("{h}");
 | |
|     //~^ NOTE immutable borrow later used here
 | |
| }
 | 
