mirror of
				https://github.com/rust-lang/rust.git
				synced 2025-10-31 04:57:19 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			12 lines
		
	
	
		
			315 B
		
	
	
	
		
			Rust
		
	
	
	
	
	
			
		
		
	
	
			12 lines
		
	
	
		
			315 B
		
	
	
	
		
			Rust
		
	
	
	
	
	
| fn main() {
 | |
|   let s = "abc";
 | |
|   let t = if true { s[..2] } else { s };
 | |
|   //~^ ERROR `if` and `else` have incompatible types
 | |
|   let u: &str = if true { s[..2] } else { s };
 | |
|   //~^ ERROR mismatched types
 | |
|   let v = s[..2];
 | |
|   //~^ ERROR the size for values of type
 | |
|   let w: &str = s[..2];
 | |
|   //~^ ERROR mismatched types
 | |
| }
 | 
