2014-12-12 23:39:27 +00:00
|
|
|
// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT
|
2012-12-11 01:32:48 +00:00
|
|
|
// 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.
|
|
|
|
|
2015-03-22 20:13:15 +00:00
|
|
|
|
2013-10-17 01:34:01 +00:00
|
|
|
use std::mem;
|
2013-05-25 02:35:29 +00:00
|
|
|
|
2012-10-16 00:09:05 +00:00
|
|
|
struct Cat {
|
2015-03-26 00:06:52 +00:00
|
|
|
x: isize
|
2012-10-16 00:09:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
struct Kitty {
|
2015-03-26 00:06:52 +00:00
|
|
|
x: isize,
|
2012-11-14 06:22:37 +00:00
|
|
|
}
|
|
|
|
|
2013-02-14 19:47:00 +00:00
|
|
|
impl Drop for Kitty {
|
2013-09-17 01:18:07 +00:00
|
|
|
fn drop(&mut self) {}
|
2012-10-16 00:09:05 +00:00
|
|
|
}
|
|
|
|
|
2016-01-13 00:55:51 +00:00
|
|
|
#[cfg(target_pointer_width = "64")]
|
2013-02-02 03:43:17 +00:00
|
|
|
pub fn main() {
|
2015-03-26 00:06:52 +00:00
|
|
|
assert_eq!(mem::size_of::<Cat>(), 8 as usize);
|
|
|
|
assert_eq!(mem::size_of::<Kitty>(), 16 as usize);
|
2012-10-16 00:09:05 +00:00
|
|
|
}
|
2012-10-20 21:52:31 +00:00
|
|
|
|
2016-01-13 00:55:51 +00:00
|
|
|
#[cfg(target_pointer_width = "32")]
|
2013-02-02 03:43:17 +00:00
|
|
|
pub fn main() {
|
2015-03-26 00:06:52 +00:00
|
|
|
assert_eq!(mem::size_of::<Cat>(), 4 as usize);
|
|
|
|
assert_eq!(mem::size_of::<Kitty>(), 8 as usize);
|
2012-10-20 21:52:31 +00:00
|
|
|
}
|