]> git.lizzy.rs Git - rust.git/blob - src/test/ui/consts/const-vecs-and-slices.rs
Rollup merge of #63038 - eupn:outer-attribute-diag, r=estebank
[rust.git] / src / test / ui / consts / const-vecs-and-slices.rs
1 // run-pass
2 #![allow(non_upper_case_globals)]
3
4 static x : [isize; 4] = [1,2,3,4];
5 static y : &'static [isize] = &[1,2,3,4];
6 static z : &'static [isize; 4] = &[1,2,3,4];
7 static zz : &'static [isize] = &[1,2,3,4];
8
9 pub fn main() {
10     println!("{}", x[1]);
11     println!("{}", y[1]);
12     println!("{}", z[1]);
13     println!("{}", zz[1]);
14     assert_eq!(x[1], 2);
15     assert_eq!(x[3], 4);
16     assert_eq!(x[3], y[3]);
17     assert_eq!(z[1], 2);
18     assert_eq!(z[3], 4);
19     assert_eq!(z[3], y[3]);
20     assert_eq!(zz[1], 2);
21     assert_eq!(zz[3], 4);
22     assert_eq!(zz[3], y[3]);
23 }