2014-02-05 16:33:10 -06:00
|
|
|
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
|
|
|
|
// file at the top-level directory of this distribution and at
|
|
|
|
// http://rust-lang.org/COPYRIGHT.
|
|
|
|
//
|
|
|
|
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
|
|
|
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
|
|
|
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
|
|
|
// option. This file may not be copied, modified, or distributed
|
|
|
|
// except according to those terms.
|
|
|
|
|
2013-01-10 12:59:58 -06:00
|
|
|
fn main() {
|
2014-06-27 14:30:25 -05:00
|
|
|
let mut a = [1i, 2, 3, 4];
|
2013-03-15 14:24:24 -05:00
|
|
|
let t = match a {
|
2013-01-10 12:59:58 -06:00
|
|
|
[1, 2, ..tail] => tail,
|
2013-09-19 00:04:03 -05:00
|
|
|
_ => unreachable!()
|
2013-01-10 12:59:58 -06:00
|
|
|
};
|
2014-02-10 06:44:03 -06:00
|
|
|
a[0] = 0; //~ ERROR cannot assign to `a[..]` because it is borrowed
|
2013-03-15 14:24:24 -05:00
|
|
|
t[0];
|
2013-01-10 12:59:58 -06:00
|
|
|
}
|