]> git.lizzy.rs Git - rust.git/blob - src/test/run-pass/vec-dst.rs
Account for --remap-path-prefix in save-analysis
[rust.git] / src / test / run-pass / vec-dst.rs
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.
4 //
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.
10
11
12 #![allow(unknown_features)]
13 #![feature(box_syntax)]
14
15 pub fn main() {
16     // Tests for indexing into box/& [T; n]
17     let x: [isize; 3] = [1, 2, 3];
18     let mut x: Box<[isize; 3]> = box x;
19     assert_eq!(x[0], 1);
20     assert_eq!(x[1], 2);
21     assert_eq!(x[2], 3);
22     x[1] = 45;
23     assert_eq!(x[0], 1);
24     assert_eq!(x[1], 45);
25     assert_eq!(x[2], 3);
26
27     let mut x: [isize; 3] = [1, 2, 3];
28     let x: &mut [isize; 3] = &mut x;
29     assert_eq!(x[0], 1);
30     assert_eq!(x[1], 2);
31     assert_eq!(x[2], 3);
32     x[1] = 45;
33     assert_eq!(x[0], 1);
34     assert_eq!(x[1], 45);
35     assert_eq!(x[2], 3);
36 }