]> git.lizzy.rs Git - rust.git/blob - src/test/ui/slice-2.rs
Auto merge of #67000 - spastorino:remove-promoted-from-place, r=oli-obk
[rust.git] / src / test / ui / 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 }