import size_of = std.sys.rustrt.size_of; use std; fn main() { check (size_of[u8]() == uint(1)); check (size_of[u32]() == uint(4)); check (size_of[char]() == uint(4)); check (size_of[i8]() == uint(1)); check (size_of[i32]() == uint(4)); check (size_of[tup(u8,i8)]() == uint(2)); check (size_of[tup(u8,i8,u8)]() == uint(3)); // Alignment causes padding before the char and the u32. check (size_of[tup(u8,i8,tup(char,u8),u32)]() == uint(16)); check (size_of[int]() == size_of[uint]()); check (size_of[tup(int,())]() == size_of[int]()); check (size_of[tup(int,(),())]() == size_of[int]()); check (size_of[int]() == size_of[rec(int x)]()); } import size_of = std.sys.rustrt.size_of; use std; fn main() { check (size_of[u8]() == (1 as uint)); check (size_of[u32]() == (4 as uint)); check (size_of[char]() == (4 as uint)); check (size_of[i8]() == (1 as uint)); check (size_of[i32]() == (4 as uint)); check (size_of[tup(u8,i8)]() == (2 as uint)); check (size_of[tup(u8,i8,u8)]() == (3 as uint)); // Alignment causes padding before the char and the u32. check (size_of[tup(u8,i8,tup(char,u8),u32)]() == (16 as uint)); check (size_of[int]() == size_of[uint]()); check (size_of[tup(int,())]() == size_of[int]()); check (size_of[tup(int,(),())]() == size_of[int]()); check (size_of[int]() == size_of[rec(int x)]()); } // xfail-stage0 import size_of = std.sys.rustrt.size_of; use std; fn main() { check (size_of[u8]() == (1 as uint)); check (size_of[u32]() == (4 as uint)); check (size_of[char]() == (4 as uint)); check (size_of[i8]() == (1 as uint)); check (size_of[i32]() == (4 as uint)); check (size_of[tup(u8,i8)]() == (2 as uint)); check (size_of[tup(u8,i8,u8)]() == (3 as uint)); // Alignment causes padding before the char and the u32. check (size_of[tup(u8,i8,tup(char,u8),u32)]() == (16 as uint)); check (size_of[int]() == size_of[uint]()); check (size_of[tup(int,())]() == size_of[int]()); check (size_of[tup(int,(),())]() == size_of[int]()); check (size_of[int]() == size_of[rec(int x)]()); } // xfail-stage0 import size_of = std.sys.rustrt.size_of; use std; fn main() { assert (size_of[u8]() == (1 as uint)); assert (size_of[u32]() == (4 as uint)); assert (size_of[char]() == (4 as uint)); assert (size_of[i8]() == (1 as uint)); assert (size_of[i32]() == (4 as uint)); assert (size_of[tup(u8,i8)]() == (2 as uint)); assert (size_of[tup(u8,i8,u8)]() == (3 as uint)); // Alignment causes padding before the char and the u32. assert (size_of[tup(u8,i8,tup(char,u8),u32)]() == (16 as uint)); assert (size_of[int]() == size_of[uint]()); assert (size_of[tup(int,())]() == size_of[int]()); assert (size_of[tup(int,(),())]() == size_of[int]()); assert (size_of[int]() == size_of[rec(int x)]()); } // xfail-stage0 import size_of = std.sys.rustrt.size_of; use std; fn main() { check (size_of[u8]() == (1 as uint)); check (size_of[u32]() == (4 as uint)); check (size_of[char]() == (4 as uint)); check (size_of[i8]() == (1 as uint)); check (size_of[i32]() == (4 as uint)); check (size_of[tup(u8,i8)]() == (2 as uint)); check (size_of[tup(u8,i8,u8)]() == (3 as uint)); // Alignment causes padding before the char and the u32. check (size_of[tup(u8,i8,tup(char,u8),u32)]() == (16 as uint)); check (size_of[int]() == size_of[uint]()); check (size_of[tup(int,())]() == size_of[int]()); check (size_of[tup(int,(),())]() == size_of[int]()); check (size_of[int]() == size_of[rec(int x)]()); } // xfail-stage0 import size_of = std.sys.rustrt.size_of; use std; fn main() { assert (size_of[u8]() == (1 as uint)); assert (size_of[u32]() == (4 as uint)); assert (size_of[char]() == (4 as uint)); assert (size_of[i8]() == (1 as uint)); assert (size_of[i32]() == (4 as uint)); assert (size_of[tup(u8,i8)]() == (2 as uint)); assert (size_of[tup(u8,i8,u8)]() == (3 as uint)); // Alignment causes padding before the char and the u32. assert (size_of[tup(u8,i8,tup(char,u8),u32)]() == (16 as uint)); assert (size_of[int]() == size_of[uint]()); assert (size_of[tup(int,())]() == size_of[int]()); assert (size_of[tup(int,(),())]() == size_of[int]()); assert (size_of[int]() == size_of[rec(int x)]()); } // xfail-stage0 // xfail-stage1 // xfail-stage2 import size_of = std.sys.rustrt.size_of; use std; fn main() { assert (size_of[u8]() == (1 as uint)); assert (size_of[u32]() == (4 as uint)); assert (size_of[char]() == (4 as uint)); assert (size_of[i8]() == (1 as uint)); assert (size_of[i32]() == (4 as uint)); assert (size_of[tup(u8,i8)]() == (2 as uint)); assert (size_of[tup(u8,i8,u8)]() == (3 as uint)); // Alignment causes padding before the char and the u32. assert (size_of[tup(u8,i8,tup(char,u8),u32)]() == (16 as uint)); assert (size_of[int]() == size_of[uint]()); assert (size_of[tup(int,())]() == size_of[int]()); assert (size_of[tup(int,(),())]() == size_of[int]()); assert (size_of[int]() == size_of[rec(int x)]()); } // xfail-stage0 // xfail-stage1 // xfail-stage2 import size_of = std.Sys.rustrt.size_of; use std; fn main() { assert (size_of[u8]() == (1 as uint)); assert (size_of[u32]() == (4 as uint)); assert (size_of[char]() == (4 as uint)); assert (size_of[i8]() == (1 as uint)); assert (size_of[i32]() == (4 as uint)); assert (size_of[tup(u8,i8)]() == (2 as uint)); assert (size_of[tup(u8,i8,u8)]() == (3 as uint)); // Alignment causes padding before the char and the u32. assert (size_of[tup(u8,i8,tup(char,u8),u32)]() == (16 as uint)); assert (size_of[int]() == size_of[uint]()); assert (size_of[tup(int,())]() == size_of[int]()); assert (size_of[tup(int,(),())]() == size_of[int]()); assert (size_of[int]() == size_of[rec(int x)]()); } // xfail-stage0 // xfail-stage1 // xfail-stage2 import size_of = std::sys.rustrt.size_of; use std; fn main() { assert (size_of[u8]() == (1 as uint)); assert (size_of[u32]() == (4 as uint)); assert (size_of[char]() == (4 as uint)); assert (size_of[i8]() == (1 as uint)); assert (size_of[i32]() == (4 as uint)); assert (size_of[tup(u8,i8)]() == (2 as uint)); assert (size_of[tup(u8,i8,u8)]() == (3 as uint)); // Alignment causes padding before the char and the u32. assert (size_of[tup(u8,i8,tup(char,u8),u32)]() == (16 as uint)); assert (size_of[int]() == size_of[uint]()); assert (size_of[tup(int,())]() == size_of[int]()); assert (size_of[tup(int,(),())]() == size_of[int]()); assert (size_of[int]() == size_of[rec(int x)]()); } // xfail-stage0 // xfail-stage1 // xfail-stage2 import size_of = std::sys::rustrt::size_of; use std; fn main() { assert (size_of[u8]() == (1 as uint)); assert (size_of[u32]() == (4 as uint)); assert (size_of[char]() == (4 as uint)); assert (size_of[i8]() == (1 as uint)); assert (size_of[i32]() == (4 as uint)); assert (size_of[tup(u8,i8)]() == (2 as uint)); assert (size_of[tup(u8,i8,u8)]() == (3 as uint)); // Alignment causes padding before the char and the u32. assert (size_of[tup(u8,i8,tup(char,u8),u32)]() == (16 as uint)); assert (size_of[int]() == size_of[uint]()); assert (size_of[tup(int,())]() == size_of[int]()); assert (size_of[tup(int,(),())]() == size_of[int]()); assert (size_of[int]() == size_of[rec(int x)]()); } // xfail-stage0 // xfail-stage1 // xfail-stage2 import std::sys::rustrt::size_of; use std; fn main() { assert (size_of[u8]() == 1 as uint); assert (size_of[u32]() == 4 as uint); assert (size_of[char]() == 4 as uint); assert (size_of[i8]() == 1 as uint); assert (size_of[i32]() == 4 as uint); assert (size_of[tup(u8, i8)]() == 2 as uint); assert (size_of[tup(u8, i8, u8)]() == 3 as uint); // Alignment causes padding before the char and the u32. assert (size_of[tup(u8, i8, tup(char, u8), u32)]() == 16 as uint); assert (size_of[int]() == size_of[uint]()); assert (size_of[tup(int, ())]() == size_of[int]()); assert (size_of[tup(int, (), ())]() == size_of[int]()); assert (size_of[int]() == size_of[rec(int x)]()); } // xfail-stage0 // xfail-stage1 // xfail-stage2 // xfail-stage3 import std::sys::rustrt::size_of; use std; fn main() { assert (size_of[u8]() == 1 as uint); assert (size_of[u32]() == 4 as uint); assert (size_of[char]() == 4 as uint); assert (size_of[i8]() == 1 as uint); assert (size_of[i32]() == 4 as uint); assert (size_of[tup(u8, i8)]() == 2 as uint); assert (size_of[tup(u8, i8, u8)]() == 3 as uint); // Alignment causes padding before the char and the u32. assert (size_of[tup(u8, i8, tup(char, u8), u32)]() == 16 as uint); assert (size_of[int]() == size_of[uint]()); assert (size_of[tup(int, ())]() == size_of[int]()); assert (size_of[tup(int, (), ())]() == size_of[int]()); assert (size_of[int]() == size_of[rec(int x)]()); } // xfail-stage0 // xfail-stage1 // xfail-stage2 // xfail-stage3 import std::sys::rustrt::size_of; use std; fn main() { assert (size_of[u8]() == 1 as uint); assert (size_of[u32]() == 4 as uint); assert (size_of[char]() == 4 as uint); assert (size_of[i8]() == 1 as uint); assert (size_of[i32]() == 4 as uint); assert (size_of[rec(u8 a, i8 b)]() == 2 as uint); assert (size_of[rec(u8 a, i8 b, u8 c)]() == 3 as uint); // Alignment causes padding before the char and the u32. assert (size_of[rec(u8 a, i8 b, rec(char u, u8 v) c, u32 d)]() == 16 as uint); assert (size_of[int]() == size_of[uint]()); assert (size_of[rec(int a, () b)]() == size_of[int]()); assert (size_of[rec(int a, () b, () c)]() == size_of[int]()); assert (size_of[int]() == size_of[rec(int x)]()); } // xfail-stage0 // xfail-stage1 // xfail-stage2 // xfail-stage3 import std::sys::rustrt::size_of; use std; fn main() { assert (size_of[u8]() == 1 as uint); assert (size_of[u32]() == 4 as uint); assert (size_of[char]() == 4 as uint); assert (size_of[i8]() == 1 as uint); assert (size_of[i32]() == 4 as uint); assert (size_of[{a: u8, b: i8}]() == 2 as uint); assert (size_of[{a: u8, b: i8, c: u8}]() == 3 as uint); // Alignment causes padding before the char and the u32. assert (size_of[{a: u8, b: i8, c: {u: char, v: u8}, d: u32}]() == 16 as uint); assert (size_of[int]() == size_of[uint]()); assert (size_of[{a: int, b: ()}]() == size_of[int]()); assert (size_of[{a: int, b: (), c: ()}]() == size_of[int]()); assert (size_of[int]() == size_of[{x: int}]()); } // xfail-stage1 // xfail-stage2 // xfail-stage3 import std::sys::rustrt::size_of; use std; fn main() { assert (size_of[u8]() == 1 as uint); assert (size_of[u32]() == 4 as uint); assert (size_of[char]() == 4 as uint); assert (size_of[i8]() == 1 as uint); assert (size_of[i32]() == 4 as uint); assert (size_of[{a: u8, b: i8}]() == 2 as uint); assert (size_of[{a: u8, b: i8, c: u8}]() == 3 as uint); // Alignment causes padding before the char and the u32. assert (size_of[{a: u8, b: i8, c: {u: char, v: u8}, d: u32}]() == 16 as uint); assert (size_of[int]() == size_of[uint]()); assert (size_of[{a: int, b: ()}]() == size_of[int]()); assert (size_of[{a: int, b: (), c: ()}]() == size_of[int]()); assert (size_of[int]() == size_of[{x: int}]()); } // xfail-stage1 // xfail-stage2 // xfail-stage3 import std::sys::rustrt::size_of; use std; fn main() { assert (size_of::<u8>() == 1 as uint); assert (size_of::<u32>() == 4 as uint); assert (size_of::<char>() == 4 as uint); assert (size_of::<i8>() == 1 as uint); assert (size_of::<i32>() == 4 as uint); assert (size_of::<{a: u8, b: i8}>() == 2 as uint); assert (size_of::<{a: u8, b: i8, c: u8}>() == 3 as uint); // Alignment causes padding before the char and the u32. assert (size_of::<{a: u8, b: i8, c: {u: char, v: u8}, d: u32}>() == 16 as uint); assert (size_of::<int>() == size_of::<uint>()); assert (size_of::<{a: int, b: ()}>() == size_of::<int>()); assert (size_of::<{a: int, b: (), c: ()}>() == size_of::<int>()); assert (size_of::<int>() == size_of::<{x: int}>()); } // xfail-test import std::sys::rustrt::size_of; use std; fn main() { assert (size_of::<u8>() == 1 as uint); assert (size_of::<u32>() == 4 as uint); assert (size_of::<char>() == 4 as uint); assert (size_of::<i8>() == 1 as uint); assert (size_of::<i32>() == 4 as uint); assert (size_of::<{a: u8, b: i8}>() == 2 as uint); assert (size_of::<{a: u8, b: i8, c: u8}>() == 3 as uint); // Alignment causes padding before the char and the u32. assert (size_of::<{a: u8, b: i8, c: {u: char, v: u8}, d: u32}>() == 16 as uint); assert (size_of::<int>() == size_of::<uint>()); assert (size_of::<{a: int, b: ()}>() == size_of::<int>()); assert (size_of::<{a: int, b: (), c: ()}>() == size_of::<int>()); assert (size_of::<int>() == size_of::<{x: int}>()); } // xfail-stage1 // xfail-stage2 // xfail-stage3 import std::sys::rustrt::size_of; use std; fn main() { assert (size_of::<u8>() == 1 as uint); assert (size_of::<u32>() == 4 as uint); assert (size_of::<char>() == 4 as uint); assert (size_of::<i8>() == 1 as uint); assert (size_of::<i32>() == 4 as uint); assert (size_of::<{a: u8, b: i8}>() == 2 as uint); assert (size_of::<{a: u8, b: i8, c: u8}>() == 3 as uint); // Alignment causes padding before the char and the u32. assert (size_of::<{a: u8, b: i8, c: {u: char, v: u8}, d: u32}>() == 16 as uint); assert (size_of::<int>() == size_of::<uint>()); assert (size_of::<{a: int, b: ()}>() == size_of::<int>()); assert (size_of::<{a: int, b: (), c: ()}>() == size_of::<int>()); assert (size_of::<int>() == size_of::<{x: int}>()); } // xfail-test import std::sys::rustrt::size_of; use std; fn main() { assert (size_of::<u8>() == 1 as uint); assert (size_of::<u32>() == 4 as uint); assert (size_of::<char>() == 4 as uint); assert (size_of::<i8>() == 1 as uint); assert (size_of::<i32>() == 4 as uint); assert (size_of::<{a: u8, b: i8}>() == 2 as uint); assert (size_of::<{a: u8, b: i8, c: u8}>() == 3 as uint); // Alignment causes padding before the char and the u32. assert (size_of::<{a: u8, b: i8, c: {u: char, v: u8}, d: u32}>() == 16 as uint); assert (size_of::<int>() == size_of::<uint>()); assert (size_of::<{a: int, b: ()}>() == size_of::<int>()); assert (size_of::<{a: int, b: (), c: ()}>() == size_of::<int>()); assert (size_of::<int>() == size_of::<{x: int}>()); } // xfail-test import sys::rustrt::size_of; use std; fn main() { assert (size_of::<u8>() == 1 as uint); assert (size_of::<u32>() == 4 as uint); assert (size_of::<char>() == 4 as uint); assert (size_of::<i8>() == 1 as uint); assert (size_of::<i32>() == 4 as uint); assert (size_of::<{a: u8, b: i8}>() == 2 as uint); assert (size_of::<{a: u8, b: i8, c: u8}>() == 3 as uint); // Alignment causes padding before the char and the u32. assert (size_of::<{a: u8, b: i8, c: {u: char, v: u8}, d: u32}>() == 16 as uint); assert (size_of::<int>() == size_of::<uint>()); assert (size_of::<{a: int, b: ()}>() == size_of::<int>()); assert (size_of::<{a: int, b: (), c: ()}>() == size_of::<int>()); assert (size_of::<int>() == size_of::<{x: int}>()); } // xfail-test use sys::rustrt::size_of; use std; fn main() { assert (size_of::<u8>() == 1 as uint); assert (size_of::<u32>() == 4 as uint); assert (size_of::<char>() == 4 as uint); assert (size_of::<i8>() == 1 as uint); assert (size_of::<i32>() == 4 as uint); assert (size_of::<{a: u8, b: i8}>() == 2 as uint); assert (size_of::<{a: u8, b: i8, c: u8}>() == 3 as uint); // Alignment causes padding before the char and the u32. assert (size_of::<{a: u8, b: i8, c: {u: char, v: u8}, d: u32}>() == 16 as uint); assert (size_of::<int>() == size_of::<uint>()); assert (size_of::<{a: int, b: ()}>() == size_of::<int>()); assert (size_of::<{a: int, b: (), c: ()}>() == size_of::<int>()); assert (size_of::<int>() == size_of::<{x: int}>()); } // xfail-test use sys::rustrt::size_of; extern mod std; fn main() { assert (size_of::<u8>() == 1 as uint); assert (size_of::<u32>() == 4 as uint); assert (size_of::<char>() == 4 as uint); assert (size_of::<i8>() == 1 as uint); assert (size_of::<i32>() == 4 as uint); assert (size_of::<{a: u8, b: i8}>() == 2 as uint); assert (size_of::<{a: u8, b: i8, c: u8}>() == 3 as uint); // Alignment causes padding before the char and the u32. assert (size_of::<{a: u8, b: i8, c: {u: char, v: u8}, d: u32}>() == 16 as uint); assert (size_of::<int>() == size_of::<uint>()); assert (size_of::<{a: int, b: ()}>() == size_of::<int>()); assert (size_of::<{a: int, b: (), c: ()}>() == size_of::<int>()); assert (size_of::<int>() == size_of::<{x: int}>()); } // Copyright 2012 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your // option. This file may not be copied, modified, or distributed // except according to those terms. // xfail-test use sys::rustrt::size_of; extern mod std; fn main() { assert (size_of::<u8>() == 1 as uint); assert (size_of::<u32>() == 4 as uint); assert (size_of::<char>() == 4 as uint); assert (size_of::<i8>() == 1 as uint); assert (size_of::<i32>() == 4 as uint); assert (size_of::<{a: u8, b: i8}>() == 2 as uint); assert (size_of::<{a: u8, b: i8, c: u8}>() == 3 as uint); // Alignment causes padding before the char and the u32. assert (size_of::<{a: u8, b: i8, c: {u: char, v: u8}, d: u32}>() == 16 as uint); assert (size_of::<int>() == size_of::<uint>()); assert (size_of::<{a: int, b: ()}>() == size_of::<int>()); assert (size_of::<{a: int, b: (), c: ()}>() == size_of::<int>()); assert (size_of::<int>() == size_of::<{x: int}>()); } // Copyright 2012 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your // option. This file may not be copied, modified, or distributed // except according to those terms. // xfail-test use sys::rustrt::size_of; extern mod std; pub fn main() { assert (size_of::<u8>() == 1 as uint); assert (size_of::<u32>() == 4 as uint); assert (size_of::<char>() == 4 as uint); assert (size_of::<i8>() == 1 as uint); assert (size_of::<i32>() == 4 as uint); assert (size_of::<{a: u8, b: i8}>() == 2 as uint); assert (size_of::<{a: u8, b: i8, c: u8}>() == 3 as uint); // Alignment causes padding before the char and the u32. assert (size_of::<{a: u8, b: i8, c: {u: char, v: u8}, d: u32}>() == 16 as uint); assert (size_of::<int>() == size_of::<uint>()); assert (size_of::<{a: int, b: ()}>() == size_of::<int>()); assert (size_of::<{a: int, b: (), c: ()}>() == size_of::<int>()); assert (size_of::<int>() == size_of::<{x: int}>()); } // Copyright 2012 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your // option. This file may not be copied, modified, or distributed // except according to those terms. // xfail-test use sys::rustrt::size_of; extern mod std; pub fn main() { fail_unless!((size_of::<u8>() == 1 as uint)); fail_unless!((size_of::<u32>() == 4 as uint)); fail_unless!((size_of::<char>() == 4 as uint)); fail_unless!((size_of::<i8>() == 1 as uint)); fail_unless!((size_of::<i32>() == 4 as uint)); fail_unless!((size_of::<{a: u8, b: i8}>() == 2 as uint)); fail_unless!((size_of::<{a: u8, b: i8, c: u8}>() == 3 as uint)); // Alignment causes padding before the char and the u32. assert (size_of::<{a: u8, b: i8, c: {u: char, v: u8}, d: u32}>() == 16 as uint); fail_unless!((size_of::<int>() == size_of::<uint>())); fail_unless!((size_of::<{a: int, b: ()}>() == size_of::<int>())); fail_unless!((size_of::<{a: int, b: (), c: ()}>() == size_of::<int>())); fail_unless!((size_of::<int>() == size_of::<{x: int}>())); } // Copyright 2012 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your // option. This file may not be copied, modified, or distributed // except according to those terms. // xfail-test use sys::rustrt::size_of; extern mod std; pub fn main() { fail_unless!((size_of::<u8>() == 1 as uint)); fail_unless!((size_of::<u32>() == 4 as uint)); fail_unless!((size_of::<char>() == 4 as uint)); fail_unless!((size_of::<i8>() == 1 as uint)); fail_unless!((size_of::<i32>() == 4 as uint)); fail_unless!((size_of::<{a: u8, b: i8}>() == 2 as uint)); fail_unless!((size_of::<{a: u8, b: i8, c: u8}>() == 3 as uint)); // Alignment causes padding before the char and the u32. fail_unless!(size_of::<{a: u8, b: i8, c: {u: char, v: u8}, d: u32}>() == 16 as uint); fail_unless!((size_of::<int>() == size_of::<uint>())); fail_unless!((size_of::<{a: int, b: ()}>() == size_of::<int>())); fail_unless!((size_of::<{a: int, b: (), c: ()}>() == size_of::<int>())); fail_unless!((size_of::<int>() == size_of::<{x: int}>())); } // Copyright 2012 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your // option. This file may not be copied, modified, or distributed // except according to those terms. // xfail-test use sys::rustrt::size_of; extern mod std; pub fn main() { assert!((size_of::<u8>() == 1 as uint)); assert!((size_of::<u32>() == 4 as uint)); assert!((size_of::<char>() == 4 as uint)); assert!((size_of::<i8>() == 1 as uint)); assert!((size_of::<i32>() == 4 as uint)); assert!((size_of::<{a: u8, b: i8}>() == 2 as uint)); assert!((size_of::<{a: u8, b: i8, c: u8}>() == 3 as uint)); // Alignment causes padding before the char and the u32. assert!(size_of::<{a: u8, b: i8, c: {u: char, v: u8}, d: u32}>() == 16 as uint); assert!((size_of::<int>() == size_of::<uint>())); assert!((size_of::<{a: int, b: ()}>() == size_of::<int>())); assert!((size_of::<{a: int, b: (), c: ()}>() == size_of::<int>())); assert!((size_of::<int>() == size_of::<{x: int}>())); } // Copyright 2012 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your // option. This file may not be copied, modified, or distributed // except according to those terms. extern mod core; use core::sys::size_of; struct t {a: u8, b: i8} struct u {a: u8, b: i8, c: u8} struct v {a: u8, b: i8, c: v2, d: u32} struct v2 {u: char, v: u8} struct w {a: int, b: ()} struct x {a: int, b: (), c: ()} struct y {x: int} pub fn main() { assert!((size_of::<u8>() == 1 as uint)); assert!((size_of::<u32>() == 4 as uint)); assert!((size_of::<char>() == 4 as uint)); assert!((size_of::<i8>() == 1 as uint)); assert!((size_of::<i32>() == 4 as uint)); assert!((size_of::<t>() == 2 as uint)); assert!((size_of::<u>() == 3 as uint)); // Alignment causes padding before the char and the u32. assert!(size_of::<v>() == 16 as uint); assert!((size_of::<int>() == size_of::<uint>())); assert!((size_of::<w>() == size_of::<int>())); assert!((size_of::<x>() == size_of::<int>())); assert!((size_of::<int>() == size_of::<y>())); } // Copyright 2012 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your // option. This file may not be copied, modified, or distributed // except according to those terms. extern mod core; use core::sys::size_of; struct t {a: u8, b: i8} struct u {a: u8, b: i8, c: u8} struct v {a: u8, b: i8, c: v2, d: u32} struct v2 {u: char, v: u8} struct w {a: int, b: ()} struct x {a: int, b: (), c: ()} struct y {x: int} pub fn main() { assert_eq!(size_of::<u8>(), 1 as uint); assert_eq!(size_of::<u32>(), 4 as uint); assert_eq!(size_of::<char>(), 4 as uint); assert_eq!(size_of::<i8>(), 1 as uint); assert_eq!(size_of::<i32>(), 4 as uint); assert_eq!(size_of::<t>(), 2 as uint); assert_eq!(size_of::<u>(), 3 as uint); // Alignment causes padding before the char and the u32. assert!(size_of::<v>() == 16 as uint); assert_eq!(size_of::<int>(), size_of::<uint>()); assert_eq!(size_of::<w>(), size_of::<int>()); assert_eq!(size_of::<x>(), size_of::<int>()); assert_eq!(size_of::<int>(), size_of::<y>()); } // Copyright 2012 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your // option. This file may not be copied, modified, or distributed // except according to those terms. extern mod std; use std::sys::size_of; struct t {a: u8, b: i8} struct u {a: u8, b: i8, c: u8} struct v {a: u8, b: i8, c: v2, d: u32} struct v2 {u: char, v: u8} struct w {a: int, b: ()} struct x {a: int, b: (), c: ()} struct y {x: int} pub fn main() { assert_eq!(size_of::<u8>(), 1 as uint); assert_eq!(size_of::<u32>(), 4 as uint); assert_eq!(size_of::<char>(), 4 as uint); assert_eq!(size_of::<i8>(), 1 as uint); assert_eq!(size_of::<i32>(), 4 as uint); assert_eq!(size_of::<t>(), 2 as uint); assert_eq!(size_of::<u>(), 3 as uint); // Alignment causes padding before the char and the u32. assert!(size_of::<v>() == 16 as uint); assert_eq!(size_of::<int>(), size_of::<uint>()); assert_eq!(size_of::<w>(), size_of::<int>()); assert_eq!(size_of::<x>(), size_of::<int>()); assert_eq!(size_of::<int>(), size_of::<y>()); } // Copyright 2012 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your // option. This file may not be copied, modified, or distributed // except according to those terms. extern mod std; use std::mem::size_of; struct t {a: u8, b: i8} struct u {a: u8, b: i8, c: u8} struct v {a: u8, b: i8, c: v2, d: u32} struct v2 {u: char, v: u8} struct w {a: int, b: ()} struct x {a: int, b: (), c: ()} struct y {x: int} pub fn main() { assert_eq!(size_of::<u8>(), 1 as uint); assert_eq!(size_of::<u32>(), 4 as uint); assert_eq!(size_of::<char>(), 4 as uint); assert_eq!(size_of::<i8>(), 1 as uint); assert_eq!(size_of::<i32>(), 4 as uint); assert_eq!(size_of::<t>(), 2 as uint); assert_eq!(size_of::<u>(), 3 as uint); // Alignment causes padding before the char and the u32. assert!(size_of::<v>() == 16 as uint); assert_eq!(size_of::<int>(), size_of::<uint>()); assert_eq!(size_of::<w>(), size_of::<int>()); assert_eq!(size_of::<x>(), size_of::<int>()); assert_eq!(size_of::<int>(), size_of::<y>()); } // Copyright 2012 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your // option. This file may not be copied, modified, or distributed // except according to those terms. extern crate std; use std::mem::size_of; struct t {a: u8, b: i8} struct u {a: u8, b: i8, c: u8} struct v {a: u8, b: i8, c: v2, d: u32} struct v2 {u: char, v: u8} struct w {a: int, b: ()} struct x {a: int, b: (), c: ()} struct y {x: int} pub fn main() { assert_eq!(size_of::<u8>(), 1 as uint); assert_eq!(size_of::<u32>(), 4 as uint); assert_eq!(size_of::<char>(), 4 as uint); assert_eq!(size_of::<i8>(), 1 as uint); assert_eq!(size_of::<i32>(), 4 as uint); assert_eq!(size_of::<t>(), 2 as uint); assert_eq!(size_of::<u>(), 3 as uint); // Alignment causes padding before the char and the u32. assert!(size_of::<v>() == 16 as uint); assert_eq!(size_of::<int>(), size_of::<uint>()); assert_eq!(size_of::<w>(), size_of::<int>()); assert_eq!(size_of::<x>(), size_of::<int>()); assert_eq!(size_of::<int>(), size_of::<y>()); } // Copyright 2012 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your // option. This file may not be copied, modified, or distributed // except according to those terms. use std::mem::size_of; struct t {a: u8, b: i8} struct u {a: u8, b: i8, c: u8} struct v {a: u8, b: i8, c: v2, d: u32} struct v2 {u: char, v: u8} struct w {a: int, b: ()} struct x {a: int, b: (), c: ()} struct y {x: int} pub fn main() { assert_eq!(size_of::<u8>(), 1 as uint); assert_eq!(size_of::<u32>(), 4 as uint); assert_eq!(size_of::<char>(), 4 as uint); assert_eq!(size_of::<i8>(), 1 as uint); assert_eq!(size_of::<i32>(), 4 as uint); assert_eq!(size_of::<t>(), 2 as uint); assert_eq!(size_of::<u>(), 3 as uint); // Alignment causes padding before the char and the u32. assert!(size_of::<v>() == 16 as uint); assert_eq!(size_of::<int>(), size_of::<uint>()); assert_eq!(size_of::<w>(), size_of::<int>()); assert_eq!(size_of::<x>(), size_of::<int>()); assert_eq!(size_of::<int>(), size_of::<y>()); } // Copyright 2012 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your // option. This file may not be copied, modified, or distributed // except according to those terms. use std::mem::size_of; struct t {a: u8, b: i8} struct u {a: u8, b: i8, c: u8} struct v {a: u8, b: i8, c: v2, d: u32} struct v2 {u: char, v: u8} struct w {a: int, b: ()} struct x {a: int, b: (), c: ()} struct y {x: int} enum e1 { a(u8, u32), b(u32), c } enum e2 { a(u32), b } enum e3 { a([u64, ..0], u32), b } pub fn main() { assert_eq!(size_of::<u8>(), 1 as uint); assert_eq!(size_of::<u32>(), 4 as uint); assert_eq!(size_of::<char>(), 4 as uint); assert_eq!(size_of::<i8>(), 1 as uint); assert_eq!(size_of::<i32>(), 4 as uint); assert_eq!(size_of::<t>(), 2 as uint); assert_eq!(size_of::<u>(), 3 as uint); // Alignment causes padding before the char and the u32. assert!(size_of::<v>() == 16 as uint); assert_eq!(size_of::<int>(), size_of::<uint>()); assert_eq!(size_of::<w>(), size_of::<int>()); assert_eq!(size_of::<x>(), size_of::<int>()); assert_eq!(size_of::<int>(), size_of::<y>()); // Make sure enum types are the appropriate size, mostly // around ensuring alignment is handled properly assert_eq!(size_of::<e1>(), 8 as uint); assert_eq!(size_of::<e2>(), 8 as uint); assert_eq!(size_of::<e3>(), 16 as uint); } // Copyright 2012 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your // option. This file may not be copied, modified, or distributed // except according to those terms. use std::mem::size_of; struct t {a: u8, b: i8} struct u {a: u8, b: i8, c: u8} struct v {a: u8, b: i8, c: v2, d: u32} struct v2 {u: char, v: u8} struct w {a: int, b: ()} struct x {a: int, b: (), c: ()} struct y {x: int} enum e1 { a(u8, u32), b(u32), c } enum e2 { a(u32), b } enum e3 { a([u64, ..0], u32), b } pub fn main() { assert_eq!(size_of::<u8>(), 1 as uint); assert_eq!(size_of::<u32>(), 4 as uint); assert_eq!(size_of::<char>(), 4 as uint); assert_eq!(size_of::<i8>(), 1 as uint); assert_eq!(size_of::<i32>(), 4 as uint); assert_eq!(size_of::<t>(), 2 as uint); assert_eq!(size_of::<u>(), 3 as uint); // Alignment causes padding before the char and the u32. assert!(size_of::<v>() == 16 as uint); assert_eq!(size_of::<int>(), size_of::<uint>()); assert_eq!(size_of::<w>(), size_of::<int>()); assert_eq!(size_of::<x>(), size_of::<int>()); assert_eq!(size_of::<int>(), size_of::<y>()); // Make sure enum types are the appropriate size, mostly // around ensuring alignment is handled properly assert_eq!(size_of::<e1>(), 8 as uint); assert_eq!(size_of::<e2>(), 8 as uint); assert_eq!(size_of::<e3>(), 16 as uint); } // Copyright 2012 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your // option. This file may not be copied, modified, or distributed // except according to those terms. use std::mem::size_of; struct t {a: u8, b: i8} struct u {a: u8, b: i8, c: u8} struct v {a: u8, b: i8, c: v2, d: u32} struct v2 {u: char, v: u8} struct w {a: int, b: ()} struct x {a: int, b: (), c: ()} struct y {x: int} enum e1 { a(u8, u32), b(u32), c } enum e2 { a(u32), b } enum e3 { a([u16, ..0], u8), b } pub fn main() { assert_eq!(size_of::<u8>(), 1 as uint); assert_eq!(size_of::<u32>(), 4 as uint); assert_eq!(size_of::<char>(), 4 as uint); assert_eq!(size_of::<i8>(), 1 as uint); assert_eq!(size_of::<i32>(), 4 as uint); assert_eq!(size_of::<t>(), 2 as uint); assert_eq!(size_of::<u>(), 3 as uint); // Alignment causes padding before the char and the u32. assert!(size_of::<v>() == 16 as uint); assert_eq!(size_of::<int>(), size_of::<uint>()); assert_eq!(size_of::<w>(), size_of::<int>()); assert_eq!(size_of::<x>(), size_of::<int>()); assert_eq!(size_of::<int>(), size_of::<y>()); // Make sure enum types are the appropriate size, mostly // around ensuring alignment is handled properly assert_eq!(size_of::<e1>(), 8 as uint); assert_eq!(size_of::<e2>(), 8 as uint); assert_eq!(size_of::<e3>(), 4 as uint); } // Copyright 2012 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your // option. This file may not be copied, modified, or distributed // except according to those terms. use std::mem::size_of; struct t {a: u8, b: i8} struct u {a: u8, b: i8, c: u8} struct v {a: u8, b: i8, c: v2, d: u32} struct v2 {u: char, v: u8} struct w {a: int, b: ()} struct x {a: int, b: (), c: ()} struct y {x: int} enum e1 { a(u8, u32), b(u32), c } enum e2 { a(u32), b } enum e3 { a([u16; 0], u8), b } pub fn main() { assert_eq!(size_of::<u8>(), 1 as uint); assert_eq!(size_of::<u32>(), 4 as uint); assert_eq!(size_of::<char>(), 4 as uint); assert_eq!(size_of::<i8>(), 1 as uint); assert_eq!(size_of::<i32>(), 4 as uint); assert_eq!(size_of::<t>(), 2 as uint); assert_eq!(size_of::<u>(), 3 as uint); // Alignment causes padding before the char and the u32. assert!(size_of::<v>() == 16 as uint); assert_eq!(size_of::<int>(), size_of::<uint>()); assert_eq!(size_of::<w>(), size_of::<int>()); assert_eq!(size_of::<x>(), size_of::<int>()); assert_eq!(size_of::<int>(), size_of::<y>()); // Make sure enum types are the appropriate size, mostly // around ensuring alignment is handled properly assert_eq!(size_of::<e1>(), 8 as uint); assert_eq!(size_of::<e2>(), 8 as uint); assert_eq!(size_of::<e3>(), 4 as uint); } // Copyright 2012 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your // option. This file may not be copied, modified, or distributed // except according to those terms. // pretty-expanded FIXME #23616 use std::mem::size_of; struct t {a: u8, b: i8} struct u {a: u8, b: i8, c: u8} struct v {a: u8, b: i8, c: v2, d: u32} struct v2 {u: char, v: u8} struct w {a: int, b: ()} struct x {a: int, b: (), c: ()} struct y {x: int} enum e1 { a(u8, u32), b(u32), c } enum e2 { a(u32), b } enum e3 { a([u16; 0], u8), b } pub fn main() { assert_eq!(size_of::<u8>(), 1 as uint); assert_eq!(size_of::<u32>(), 4 as uint); assert_eq!(size_of::<char>(), 4 as uint); assert_eq!(size_of::<i8>(), 1 as uint); assert_eq!(size_of::<i32>(), 4 as uint); assert_eq!(size_of::<t>(), 2 as uint); assert_eq!(size_of::<u>(), 3 as uint); // Alignment causes padding before the char and the u32. assert!(size_of::<v>() == 16 as uint); assert_eq!(size_of::<int>(), size_of::<uint>()); assert_eq!(size_of::<w>(), size_of::<int>()); assert_eq!(size_of::<x>(), size_of::<int>()); assert_eq!(size_of::<int>(), size_of::<y>()); // Make sure enum types are the appropriate size, mostly // around ensuring alignment is handled properly assert_eq!(size_of::<e1>(), 8 as uint); assert_eq!(size_of::<e2>(), 8 as uint); assert_eq!(size_of::<e3>(), 4 as uint); } // Copyright 2012 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your // option. This file may not be copied, modified, or distributed // except according to those terms. // pretty-expanded FIXME #23616 use std::mem::size_of; struct t {a: u8, b: i8} struct u {a: u8, b: i8, c: u8} struct v {a: u8, b: i8, c: v2, d: u32} struct v2 {u: char, v: u8} struct w {a: isize, b: ()} struct x {a: isize, b: (), c: ()} struct y {x: isize} enum e1 { a(u8, u32), b(u32), c } enum e2 { a(u32), b } enum e3 { a([u16; 0], u8), b } pub fn main() { assert_eq!(size_of::<u8>(), 1 as usize); assert_eq!(size_of::<u32>(), 4 as usize); assert_eq!(size_of::<char>(), 4 as usize); assert_eq!(size_of::<i8>(), 1 as usize); assert_eq!(size_of::<i32>(), 4 as usize); assert_eq!(size_of::<t>(), 2 as usize); assert_eq!(size_of::<u>(), 3 as usize); // Alignment causes padding before the char and the u32. assert!(size_of::<v>() == 16 as usize); assert_eq!(size_of::<isize>(), size_of::<usize>()); assert_eq!(size_of::<w>(), size_of::<isize>()); assert_eq!(size_of::<x>(), size_of::<isize>()); assert_eq!(size_of::<isize>(), size_of::<y>()); // Make sure enum types are the appropriate size, mostly // around ensuring alignment is handled properly assert_eq!(size_of::<e1>(), 8 as usize); assert_eq!(size_of::<e2>(), 8 as usize); assert_eq!(size_of::<e3>(), 4 as usize); } // Copyright 2012 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your // option. This file may not be copied, modified, or distributed // except according to those terms. use std::mem::size_of; struct t {a: u8, b: i8} struct u {a: u8, b: i8, c: u8} struct v {a: u8, b: i8, c: v2, d: u32} struct v2 {u: char, v: u8} struct w {a: isize, b: ()} struct x {a: isize, b: (), c: ()} struct y {x: isize} enum e1 { a(u8, u32), b(u32), c } enum e2 { a(u32), b } enum e3 { a([u16; 0], u8), b } pub fn main() { assert_eq!(size_of::<u8>(), 1 as usize); assert_eq!(size_of::<u32>(), 4 as usize); assert_eq!(size_of::<char>(), 4 as usize); assert_eq!(size_of::<i8>(), 1 as usize); assert_eq!(size_of::<i32>(), 4 as usize); assert_eq!(size_of::<t>(), 2 as usize); assert_eq!(size_of::<u>(), 3 as usize); // Alignment causes padding before the char and the u32. assert!(size_of::<v>() == 16 as usize); assert_eq!(size_of::<isize>(), size_of::<usize>()); assert_eq!(size_of::<w>(), size_of::<isize>()); assert_eq!(size_of::<x>(), size_of::<isize>()); assert_eq!(size_of::<isize>(), size_of::<y>()); // Make sure enum types are the appropriate size, mostly // around ensuring alignment is handled properly assert_eq!(size_of::<e1>(), 8 as usize); assert_eq!(size_of::<e2>(), 8 as usize); assert_eq!(size_of::<e3>(), 4 as usize); }