mirror of
				https://github.com/rust-lang/rust.git
				synced 2025-10-31 13:04:42 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			12 lines
		
	
	
		
			384 B
		
	
	
	
		
			Rust
		
	
	
	
	
	
			
		
		
	
	
			12 lines
		
	
	
		
			384 B
		
	
	
	
		
			Rust
		
	
	
	
	
	
| // Test that slicing syntax gives errors if we have not implemented the trait.
 | |
| 
 | |
| struct Foo;
 | |
| 
 | |
| fn main() {
 | |
|     let x = Foo;
 | |
|     &x[..]; //~ ERROR cannot index into a value of type `Foo`
 | |
|     &x[Foo..]; //~ ERROR cannot index into a value of type `Foo`
 | |
|     &x[..Foo]; //~ ERROR cannot index into a value of type `Foo`
 | |
|     &x[Foo..Foo]; //~ ERROR cannot index into a value of type `Foo`
 | |
| }
 | 
