]> git.lizzy.rs Git - rust.git/blob - src/test/ui/borrowck/borrowck-vec-pattern-move-tail.rs
Rollup merge of #63055 - Mark-Simulacrum:save-analysis-clean-2, r=Xanewok
[rust.git] / src / test / ui / borrowck / borrowck-vec-pattern-move-tail.rs
1 // http://rust-lang.org/COPYRIGHT.
2
3 #![feature(slice_patterns)]
4
5 fn main() {
6     let mut a = [1, 2, 3, 4];
7     let t = match a {
8         [1, 2, ref tail @ ..] => tail,
9         _ => unreachable!()
10     };
11     println!("t[0]: {}", t[0]);
12     a[2] = 0; //~ ERROR cannot assign to `a[_]` because it is borrowed
13     println!("t[0]: {}", t[0]);
14     t[0];
15 }