]>
Commit | Line | Data |
---|---|---|
1a4d82fc JJ |
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 | // Check that the various ways of getting to a reference to a vec (both sized | |
12 | // and unsized) work properly. | |
13 | ||
1a4d82fc | 14 | |
c34b1796 AL |
15 | const aa: [isize; 3] = [1, 2, 3]; |
16 | const ab: &'static [isize; 3] = &aa; | |
17 | const ac: &'static [isize] = ab; | |
18 | const ad: &'static [isize] = &aa; | |
19 | const ae: &'static [isize; 3] = &[1, 2, 3]; | |
20 | const af: &'static [isize] = &[1, 2, 3]; | |
21 | ||
22 | static ca: isize = aa[0]; | |
23 | static cb: isize = ab[1]; | |
24 | static cc: isize = ac[2]; | |
25 | static cd: isize = ad[0]; | |
26 | static ce: isize = ae[1]; | |
27 | static cf: isize = af[2]; | |
1a4d82fc JJ |
28 | |
29 | fn main () { | |
c34b1796 | 30 | let b: &[isize] = &[1, 2, 3]; |
1a4d82fc JJ |
31 | assert!(ac == b); |
32 | assert!(ad == b); | |
33 | assert!(af == b); | |
34 | ||
35 | assert!(ca == 1); | |
36 | assert!(cb == 2); | |
37 | assert!(cc == 3); | |
38 | assert!(cd == 1); | |
39 | assert!(ce == 2); | |
40 | assert!(cf == 3); | |
41 | } |