mirror of
				https://github.com/rust-lang/rust.git
				synced 2025-10-31 04:57:19 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			15 lines
		
	
	
		
			321 B
		
	
	
	
		
			Rust
		
	
	
	
	
	
			
		
		
	
	
			15 lines
		
	
	
		
			321 B
		
	
	
	
		
			Rust
		
	
	
	
	
	
| // edition:2018
 | |
| struct S {
 | |
|     foo: usize,
 | |
| }
 | |
| impl S {
 | |
|     async fn bar(&self) { //~ HELP consider changing this to be a mutable reference
 | |
|         //~| SUGGESTION &mut self
 | |
|         self.foo += 1; //~ ERROR cannot assign to `self.foo`, which is behind a `&` reference [E0594]
 | |
|     }
 | |
| }
 | |
| 
 | |
| fn main() {
 | |
|     S { foo: 1 }.bar();
 | |
| }
 | 
