]> git.proxmox.com Git - rustc.git/blame - src/test/run-pass/vec-fixed-length.rs
Imported Upstream version 1.1.0+dfsg1
[rustc.git] / src / test / run-pass / vec-fixed-length.rs
CommitLineData
223e47cc
LB
1// Copyright 2012 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
c34b1796 11
1a4d82fc
JJ
12use std::mem::size_of;
13
d9579d0f
AL
14#[cfg(not(target_pointer_width = "64"))]
15fn test_big_vec() {}
16
17#[cfg(target_pointer_width = "64")]
18fn test_big_vec()
19{
20 assert_eq!(size_of::<[u8; (1 << 32)]>(), (1 << 32));
21}
22
23fn main() {
c34b1796 24 let x: [isize; 4] = [1, 2, 3, 4];
1a4d82fc
JJ
25 assert_eq!(x[0], 1);
26 assert_eq!(x[1], 2);
27 assert_eq!(x[2], 3);
28 assert_eq!(x[3], 4);
29
c34b1796 30 assert_eq!(size_of::<[u8; 4]>(), 4);
d9579d0f 31 test_big_vec();
223e47cc 32}