1 // Copyright 2014 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution and at
3 // http://rust-lang.org/COPYRIGHT.
5 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8 // option. This file may not be copied, modified, or distributed
9 // except according to those terms.
12 // Test for a &[T] => &&[T] coercion in sub-expression position
13 // (surprisingly, this can cause errors which are not caused by either of:
14 // `let x = vec.slice_mut(0, 2);`
15 // `foo(vec.slice_mut(0, 2));` ).
16 let mut vec: Vec<int> = vec!(1, 2, 3, 4);
17 let b: &mut [int] = [1, 2];
18 assert!(vec.slice_mut(0, 2) == b);
22 // Tests for indexing into box/& [T, ..n]
23 let x: [int, ..3] = [1, 2, 3];
24 let mut x: Box<[int, ..3]> = box x;
33 let mut x: [int, ..3] = [1, 2, 3];
34 let x: &mut [int, ..3] = &mut x;