summaryrefslogtreecommitdiffstats
path: root/tests/ui/array-slice-vec/slice-2.rs
blob: 5423e295a87739424b8b18cc62244e8ca3ea3fe1 (plain)
1
2
3
4
5
6
7
8
9
10
11
// 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`
}