mirror of
				https://github.com/rust-lang/rust.git
				synced 2025-10-31 04:57:19 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			17 lines
		
	
	
		
			413 B
		
	
	
	
		
			Rust
		
	
	
	
	
	
			
		
		
	
	
			17 lines
		
	
	
		
			413 B
		
	
	
	
		
			Rust
		
	
	
	
	
	
| // from rfc2005 test suite
 | |
| 
 | |
| 
 | |
| 
 | |
| // Verify the binding mode shifts - only when no `&` are auto-dereferenced is the
 | |
| // final default binding mode mutable.
 | |
| 
 | |
| fn main() {
 | |
|     let Some(n): &mut Option<i32> = &&Some(5i32) else { return }; //~ ERROR mismatched types
 | |
|     *n += 1;
 | |
|     let _ = n;
 | |
| 
 | |
|     let Some(n): &mut Option<i32> = &&mut Some(5i32) else { return }; //~ ERROR mismatched types
 | |
|     *n += 1;
 | |
|     let _ = n;
 | |
| }
 | 
