2018-08-30 07:18:55 -05:00
|
|
|
// run-pass
|
2018-09-25 16:51:35 -05:00
|
|
|
#![allow(dead_code)]
|
2015-03-22 15:13:15 -05:00
|
|
|
|
2013-10-16 20:34:01 -05:00
|
|
|
use std::mem;
|
2013-05-24 21:35:29 -05:00
|
|
|
|
2012-10-15 19:09:05 -05:00
|
|
|
struct Cat {
|
2015-03-25 19:06:52 -05:00
|
|
|
x: isize
|
2012-10-15 19:09:05 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
struct Kitty {
|
2015-03-25 19:06:52 -05:00
|
|
|
x: isize,
|
2012-11-14 00:22:37 -06:00
|
|
|
}
|
|
|
|
|
2013-02-14 13:47:00 -06:00
|
|
|
impl Drop for Kitty {
|
2013-09-16 20:18:07 -05:00
|
|
|
fn drop(&mut self) {}
|
2012-10-15 19:09:05 -05:00
|
|
|
}
|
|
|
|
|
2016-01-12 18:55:51 -06:00
|
|
|
#[cfg(target_pointer_width = "64")]
|
2013-02-01 21:43:17 -06:00
|
|
|
pub fn main() {
|
2015-03-25 19:06:52 -05:00
|
|
|
assert_eq!(mem::size_of::<Cat>(), 8 as usize);
|
2016-08-23 02:39:30 -05:00
|
|
|
assert_eq!(mem::size_of::<Kitty>(), 8 as usize);
|
2012-10-15 19:09:05 -05:00
|
|
|
}
|
2012-10-20 16:52:31 -05:00
|
|
|
|
2016-01-12 18:55:51 -06:00
|
|
|
#[cfg(target_pointer_width = "32")]
|
2013-02-01 21:43:17 -06:00
|
|
|
pub fn main() {
|
2015-03-25 19:06:52 -05:00
|
|
|
assert_eq!(mem::size_of::<Cat>(), 4 as usize);
|
2016-08-23 02:39:30 -05:00
|
|
|
assert_eq!(mem::size_of::<Kitty>(), 4 as usize);
|
2012-10-20 16:52:31 -05:00
|
|
|
}
|