mirror of
				https://github.com/rust-lang/rust.git
				synced 2025-10-31 04:57:19 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			20 lines
		
	
	
		
			266 B
		
	
	
	
		
			Rust
		
	
	
	
	
	
			
		
		
	
	
			20 lines
		
	
	
		
			266 B
		
	
	
	
		
			Rust
		
	
	
	
	
	
| struct S {
 | |
|     x: Box<isize>,
 | |
| }
 | |
| 
 | |
| 
 | |
| 
 | |
| impl S {
 | |
|     pub fn foo(self) -> isize {
 | |
|         self.bar();
 | |
|         return *self.x;  //~ ERROR use of moved value: `self`
 | |
|     }
 | |
| 
 | |
|     pub fn bar(self) {}
 | |
| }
 | |
| 
 | |
| fn main() {
 | |
|     let x = S { x: 1.into() };
 | |
|     println!("{}", x.foo());
 | |
| }
 | 
