summaryrefslogtreecommitdiffstats
path: root/src/test/ui/consts/const-vecs-and-slices.rs
blob: 1cdc33b7a34eb7354936c3411880baae4d9c4337 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
// run-pass
#![allow(non_upper_case_globals)]

static x : [isize; 4] = [1,2,3,4];
static y : &'static [isize] = &[1,2,3,4];
static z : &'static [isize; 4] = &[1,2,3,4];
static zz : &'static [isize] = &[1,2,3,4];

pub fn main() {
    println!("{}", x[1]);
    println!("{}", y[1]);
    println!("{}", z[1]);
    println!("{}", zz[1]);
    assert_eq!(x[1], 2);
    assert_eq!(x[3], 4);
    assert_eq!(x[3], y[3]);
    assert_eq!(z[1], 2);
    assert_eq!(z[3], 4);
    assert_eq!(z[3], y[3]);
    assert_eq!(zz[1], 2);
    assert_eq!(zz[3], 4);
    assert_eq!(zz[3], y[3]);
}