2018-08-30 14:18:55 +02:00
|
|
|
//@ run-pass
|
2017-10-22 20:01:00 -07:00
|
|
|
//@ ignore-wasm32-bare seems not important to test here
|
2015-03-22 13:13:15 -07:00
|
|
|
|
2023-09-25 21:40:40 +02:00
|
|
|
#![feature(intrinsics, rustc_attrs)]
|
2012-05-02 18:25:22 -07:00
|
|
|
|
2013-03-05 14:42:58 -08:00
|
|
|
mod rusti {
|
2013-07-18 19:08:57 -07:00
|
|
|
extern "rust-intrinsic" {
|
2015-03-25 17:06:52 -07:00
|
|
|
pub fn pref_align_of<T>() -> usize;
|
2022-08-18 11:15:26 +02:00
|
|
|
#[rustc_safe_intrinsic]
|
2015-03-25 17:06:52 -07:00
|
|
|
pub fn min_align_of<T>() -> usize;
|
2013-03-05 14:42:58 -08:00
|
|
|
}
|
2012-04-26 22:21:28 -07:00
|
|
|
}
|
|
|
|
|
2018-01-25 17:31:35 -02:00
|
|
|
#[cfg(any(target_os = "android",
|
2015-01-29 08:19:28 +01:00
|
|
|
target_os = "dragonfly",
|
2018-01-02 14:11:41 +01:00
|
|
|
target_os = "emscripten",
|
|
|
|
target_os = "freebsd",
|
2021-04-30 04:02:05 +00:00
|
|
|
target_os = "fuchsia",
|
2023-09-19 12:41:30 +02:00
|
|
|
target_os = "hurd",
|
2021-11-04 16:44:48 -05:00
|
|
|
target_os = "illumos",
|
2018-01-02 14:11:41 +01:00
|
|
|
target_os = "linux",
|
|
|
|
target_os = "macos",
|
2015-06-30 20:37:11 -07:00
|
|
|
target_os = "netbsd",
|
2016-01-21 19:30:22 +03:00
|
|
|
target_os = "openbsd",
|
2019-10-20 23:48:05 -07:00
|
|
|
target_os = "solaris",
|
2023-01-10 10:44:05 +01:00
|
|
|
target_os = "vxworks",
|
|
|
|
target_os = "nto",
|
|
|
|
))]
|
2012-04-30 16:44:34 -07:00
|
|
|
mod m {
|
|
|
|
#[cfg(target_arch = "x86")]
|
2012-12-28 17:17:05 -08:00
|
|
|
pub fn main() {
|
2013-01-23 16:29:31 -08:00
|
|
|
unsafe {
|
2015-03-03 10:42:26 +02:00
|
|
|
assert_eq!(::rusti::pref_align_of::<u64>(), 8);
|
|
|
|
assert_eq!(::rusti::min_align_of::<u64>(), 4);
|
2013-01-23 16:29:31 -08:00
|
|
|
}
|
2012-04-30 16:44:34 -07:00
|
|
|
}
|
|
|
|
|
2016-01-13 00:55:51 +00:00
|
|
|
#[cfg(not(target_arch = "x86"))]
|
2012-12-28 17:17:05 -08:00
|
|
|
pub fn main() {
|
2013-01-23 16:29:31 -08:00
|
|
|
unsafe {
|
2015-03-03 10:42:26 +02:00
|
|
|
assert_eq!(::rusti::pref_align_of::<u64>(), 8);
|
|
|
|
assert_eq!(::rusti::min_align_of::<u64>(), 8);
|
2013-01-23 16:29:31 -08:00
|
|
|
}
|
2012-04-30 16:44:34 -07:00
|
|
|
}
|
2012-04-26 22:21:28 -07:00
|
|
|
}
|
|
|
|
|
2019-04-24 09:26:33 -07:00
|
|
|
#[cfg(target_env = "sgx")]
|
|
|
|
mod m {
|
|
|
|
#[cfg(target_arch = "x86_64")]
|
|
|
|
pub fn main() {
|
|
|
|
unsafe {
|
|
|
|
assert_eq!(::rusti::pref_align_of::<u64>(), 8);
|
|
|
|
assert_eq!(::rusti::min_align_of::<u64>(), 8);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-08-10 21:26:45 -07:00
|
|
|
#[cfg(target_os = "windows")]
|
2012-04-30 16:44:34 -07:00
|
|
|
mod m {
|
2014-08-01 01:51:08 -07:00
|
|
|
pub fn main() {
|
|
|
|
unsafe {
|
2015-03-03 10:42:26 +02:00
|
|
|
assert_eq!(::rusti::pref_align_of::<u64>(), 8);
|
|
|
|
assert_eq!(::rusti::min_align_of::<u64>(), 8);
|
2014-08-01 01:51:08 -07:00
|
|
|
}
|
|
|
|
}
|
2012-04-26 22:21:28 -07:00
|
|
|
}
|
2021-04-08 21:37:38 +08:00
|
|
|
|
|
|
|
fn main() {
|
|
|
|
m::main();
|
|
|
|
}
|