2014-02-05 16:33:10 -06:00
|
|
|
// http://rust-lang.org/COPYRIGHT.
|
2017-09-26 14:56:37 -05:00
|
|
|
|
2015-03-26 20:34:27 -05:00
|
|
|
#![feature(slice_patterns)]
|
|
|
|
|
2013-01-10 12:59:58 -06:00
|
|
|
fn main() {
|
2015-01-31 10:23:42 -06:00
|
|
|
let mut a = [1, 2, 3, 4];
|
2013-03-15 14:24:24 -05:00
|
|
|
let t = match a {
|
2016-03-11 04:54:59 -06:00
|
|
|
[1, 2, ref tail..] => tail,
|
2013-09-19 00:04:03 -05:00
|
|
|
_ => unreachable!()
|
2013-01-10 12:59:58 -06:00
|
|
|
};
|
2015-02-04 05:25:25 -06:00
|
|
|
println!("t[0]: {}", t[0]);
|
2019-04-22 02:40:08 -05:00
|
|
|
a[2] = 0; //~ ERROR cannot assign to `a[_]` because it is borrowed
|
2015-02-04 05:25:25 -06:00
|
|
|
println!("t[0]: {}", t[0]);
|
2013-03-15 14:24:24 -05:00
|
|
|
t[0];
|
2013-01-10 12:59:58 -06:00
|
|
|
}
|