]> git.lizzy.rs Git - rust.git/blob - tests/ui/array-slice-vec/issue-69103-extra-binding-subslice.rs
Rollup merge of #106797 - FawazTirmizi:dev/issues/104284, r=bjorn3
[rust.git] / tests / ui / array-slice-vec / issue-69103-extra-binding-subslice.rs
1 // We used to not lower the extra `b @ ..` into `b @ _` which meant that no type
2 // was registered for the binding `b` although it passed through resolve.
3 // This resulted in an ICE (#69103).
4
5 fn main() {
6     let [a @ .., b @ ..] = &mut [1, 2];
7     //~^ ERROR `..` can only be used once per slice pattern
8     b;
9
10     let [.., c @ ..] = [1, 2];
11     //~^ ERROR `..` can only be used once per slice pattern
12     c;
13
14     // This never ICEd, but let's make sure it won't regress either.
15     let (.., d @ ..) = (1, 2);
16     //~^ ERROR `..` patterns are not allowed here
17     d;
18 }