]> git.lizzy.rs Git - rust.git/blob - src/test/run-pass/vec-fixed-length.rs
a0b3564d84e17f3d58373be729f334fd503939b6
[rust.git] / src / test / run-pass / vec-fixed-length.rs
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
11 use std::mem::size_of;
12
13 pub fn main() {
14     let x: [int; 4] = [1, 2, 3, 4];
15     assert_eq!(x[0], 1);
16     assert_eq!(x[1], 2);
17     assert_eq!(x[2], 3);
18     assert_eq!(x[3], 4);
19
20     assert_eq!(size_of::<[u8; 4]>(), 4);
21
22     // FIXME #10183
23     // FIXME #18069
24     //if cfg!(target_pointer_width = "64") {
25     //    assert_eq!(size_of::<[u8; (1 << 32)]>(), (1 << 32));
26     //}
27 }