]> git.lizzy.rs Git - rust.git/blob - tests/ui/array-slice-vec/slice-2.rs
Optimize `TyKind::eq`.
[rust.git] / tests / ui / array-slice-vec / slice-2.rs
1 // Test that slicing syntax gives errors if we have not implemented the trait.
2
3 struct Foo;
4
5 fn main() {
6     let x = Foo;
7     &x[..]; //~ ERROR cannot index into a value of type `Foo`
8     &x[Foo..]; //~ ERROR cannot index into a value of type `Foo`
9     &x[..Foo]; //~ ERROR cannot index into a value of type `Foo`
10     &x[Foo..Foo]; //~ ERROR cannot index into a value of type `Foo`
11 }