mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-27 01:04:03 +00:00
29 lines
478 B
Rust
29 lines
478 B
Rust
// run-pass
|
|
#![allow(dead_code)]
|
|
|
|
use std::mem;
|
|
|
|
struct Cat {
|
|
x: isize
|
|
}
|
|
|
|
struct Kitty {
|
|
x: isize,
|
|
}
|
|
|
|
impl Drop for Kitty {
|
|
fn drop(&mut self) {}
|
|
}
|
|
|
|
#[cfg(target_pointer_width = "64")]
|
|
pub fn main() {
|
|
assert_eq!(mem::size_of::<Cat>(), 8 as usize);
|
|
assert_eq!(mem::size_of::<Kitty>(), 8 as usize);
|
|
}
|
|
|
|
#[cfg(target_pointer_width = "32")]
|
|
pub fn main() {
|
|
assert_eq!(mem::size_of::<Cat>(), 4 as usize);
|
|
assert_eq!(mem::size_of::<Kitty>(), 4 as usize);
|
|
}
|