2018-08-30 12:18:55 +00:00
|
|
|
//@ run-pass
|
2018-09-25 21:51:35 +00:00
|
|
|
#![allow(dead_code)]
|
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);
|
2016-08-23 07:39:30 +00:00
|
|
|
assert_eq!(mem::size_of::<Kitty>(), 8 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);
|
2016-08-23 07:39:30 +00:00
|
|
|
assert_eq!(mem::size_of::<Kitty>(), 4 as usize);
|
2012-10-20 21:52:31 +00:00
|
|
|
}
|