提交 6301c787 编写于 作者: A Alex Crichton

rollup merge of #20680: nick29581/target-word

Closes #20421

[breaking-change]

r? @brson
......@@ -2749,9 +2749,9 @@ fn steps_between(_start: &$t, _end: &$t) -> Option<uint> {
}
step_impl!(uint u8 u16 u32 int i8 i16 i32);
#[cfg(target_word_size = "64")]
#[cfg(any(all(stage0, target_word_size = "64"), all(not(stage0), target_pointer_width = "64")))]
step_impl!(u64 i64);
#[cfg(target_word_size = "32")]
#[cfg(any(all(stage0, target_word_size = "32"), all(not(stage0), target_pointer_width = "32")))]
step_impl_no_between!(u64 i64);
......
......@@ -13,5 +13,8 @@
#![stable]
#![doc(primitive = "int")]
#[cfg(target_word_size = "32")] int_module! { int, 32 }
#[cfg(target_word_size = "64")] int_module! { int, 64 }
#[cfg(stage0)] #[cfg(target_word_size = "32")] int_module! { int, 32 }
#[cfg(stage0)] #[cfg(target_word_size = "64")] int_module! { int, 64 }
#[cfg(not(stage0))] #[cfg(target_pointer_width = "32")] int_module! { int, 32 }
#[cfg(not(stage0))] #[cfg(target_pointer_width = "64")] int_module! { int, 64 }
......@@ -496,7 +496,7 @@ unsafe fn bswap8(x: u8) -> u8 { x }
intrinsics::u64_sub_with_overflow,
intrinsics::u64_mul_with_overflow }
#[cfg(target_word_size = "32")]
#[cfg(any(all(stage0, target_word_size = "32"), all(not(stage0), target_pointer_width = "32")))]
uint_impl! { uint = u32, 32,
intrinsics::ctpop32,
intrinsics::ctlz32,
......@@ -506,7 +506,7 @@ unsafe fn bswap8(x: u8) -> u8 { x }
intrinsics::u32_sub_with_overflow,
intrinsics::u32_mul_with_overflow }
#[cfg(target_word_size = "64")]
#[cfg(any(all(stage0, target_word_size = "64"), all(not(stage0), target_pointer_width = "64")))]
uint_impl! { uint = u64, 64,
intrinsics::ctpop64,
intrinsics::ctlz64,
......@@ -601,13 +601,13 @@ fn checked_div(self, v: $T) -> Option<$T> {
intrinsics::i64_sub_with_overflow,
intrinsics::i64_mul_with_overflow }
#[cfg(target_word_size = "32")]
#[cfg(any(all(stage0, target_word_size = "32"), all(not(stage0), target_pointer_width = "32")))]
int_impl! { int = i32, u32, 32,
intrinsics::i32_add_with_overflow,
intrinsics::i32_sub_with_overflow,
intrinsics::i32_mul_with_overflow }
#[cfg(target_word_size = "64")]
#[cfg(any(all(stage0, target_word_size = "64"), all(not(stage0), target_pointer_width = "64")))]
int_impl! { int = i64, u64, 64,
intrinsics::i64_add_with_overflow,
intrinsics::i64_sub_with_overflow,
......
......@@ -272,12 +272,12 @@ fn find_libdir(sysroot: &Path) -> String {
}
}
#[cfg(target_word_size = "64")]
#[cfg(any(all(stage0, target_word_size = "64"), all(not(stage0), target_pointer_width = "64")))]
fn primary_libdir_name() -> String {
"lib64".to_string()
}
#[cfg(target_word_size = "32")]
#[cfg(any(all(stage0, target_word_size = "32"), all(not(stage0), target_pointer_width = "32")))]
fn primary_libdir_name() -> String {
"lib32".to_string()
}
......
......@@ -612,7 +612,7 @@ pub fn default_configuration(sess: &Session) -> ast::CrateConfig {
let end = sess.target.target.target_endian.index(&FullRange);
let arch = sess.target.target.arch.index(&FullRange);
let wordsz = sess.target.target.target_word_size.index(&FullRange);
let wordsz = sess.target.target.target_pointer_width.index(&FullRange);
let os = sess.target.target.target_os.index(&FullRange);
let fam = match sess.target.target.options.is_like_windows {
......@@ -627,7 +627,7 @@ pub fn default_configuration(sess: &Session) -> ast::CrateConfig {
mk(InternedString::new("target_family"), fam),
mk(InternedString::new("target_arch"), intern(arch)),
mk(InternedString::new("target_endian"), intern(end)),
mk(InternedString::new("target_word_size"),
mk(InternedString::new("target_pointer_width"),
intern(wordsz))
);
}
......@@ -661,7 +661,7 @@ pub fn build_target_config(opts: &Options, sp: &SpanHandler) -> Config {
}
};
let (int_type, uint_type) = match target.target_word_size.index(&FullRange) {
let (int_type, uint_type) = match target.target_pointer_width.index(&FullRange) {
"32" => (ast::TyI32, ast::TyU32),
"64" => (ast::TyI64, ast::TyU64),
w => sp.handler().fatal((format!("target specification was invalid: unrecognized \
......
......@@ -18,7 +18,7 @@ pub fn target() -> Target {
n32:64-S128".to_string(),
llvm_target: "aarch64-unknown-linux-gnu".to_string(),
target_endian: "little".to_string(),
target_word_size: "64".to_string(),
target_pointer_width: "64".to_string(),
arch: "aarch64".to_string(),
target_os: "linux".to_string(),
options: base,
......
......@@ -19,7 +19,7 @@ pub fn target() -> Target {
-a:0:64-n32".to_string(),
llvm_target: "arm-apple-ios".to_string(),
target_endian: "little".to_string(),
target_word_size: "32".to_string(),
target_pointer_width: "32".to_string(),
arch: "arm".to_string(),
target_os: "ios".to_string(),
options: TargetOptions {
......
......@@ -27,7 +27,7 @@ pub fn target() -> Target {
-a:0:64-n32".to_string(),
llvm_target: "arm-linux-androideabi".to_string(),
target_endian: "little".to_string(),
target_word_size: "32".to_string(),
target_pointer_width: "32".to_string(),
arch: "arm".to_string(),
target_os: "android".to_string(),
options: base,
......
......@@ -20,7 +20,7 @@ pub fn target() -> Target {
-a:0:64-n32".to_string(),
llvm_target: "arm-unknown-linux-gnueabi".to_string(),
target_endian: "little".to_string(),
target_word_size: "32".to_string(),
target_pointer_width: "32".to_string(),
arch: "arm".to_string(),
target_os: "linux".to_string(),
......
......@@ -20,7 +20,7 @@ pub fn target() -> Target {
-a:0:64-n32".to_string(),
llvm_target: "arm-unknown-linux-gnueabihf".to_string(),
target_endian: "little".to_string(),
target_word_size: "32".to_string(),
target_pointer_width: "32".to_string(),
arch: "arm".to_string(),
target_os: "linux".to_string(),
......
......@@ -19,7 +19,7 @@ pub fn target() -> Target {
-n8:16:32".to_string(),
llvm_target: "i386-apple-ios".to_string(),
target_endian: "little".to_string(),
target_word_size: "32".to_string(),
target_pointer_width: "32".to_string(),
arch: "x86".to_string(),
target_os: "ios".to_string(),
......
......@@ -22,7 +22,7 @@ pub fn target() -> Target {
-n8:16:32".to_string(),
llvm_target: "i686-apple-darwin".to_string(),
target_endian: "little".to_string(),
target_word_size: "32".to_string(),
target_pointer_width: "32".to_string(),
arch: "x86".to_string(),
target_os: "macos".to_string(),
options: base,
......
......@@ -26,7 +26,7 @@ pub fn target() -> Target {
data_layout: "e-p:32:32-f64:64:64-i64:64:64-f80:32:32-n8:16:32".to_string(),
llvm_target: "i686-pc-windows-gnu".to_string(),
target_endian: "little".to_string(),
target_word_size: "32".to_string(),
target_pointer_width: "32".to_string(),
arch: "x86".to_string(),
target_os: "windows".to_string(),
options: options,
......
......@@ -18,7 +18,7 @@ pub fn target() -> Target {
data_layout: "e-p:32:32-f64:32:64-i64:32:64-f80:32:32-n8:16:32".to_string(),
llvm_target: "i686-unknown-dragonfly".to_string(),
target_endian: "little".to_string(),
target_word_size: "32".to_string(),
target_pointer_width: "32".to_string(),
arch: "x86".to_string(),
target_os: "dragonfly".to_string(),
options: base,
......
......@@ -18,7 +18,7 @@ pub fn target() -> Target {
data_layout: "e-p:32:32-f64:32:64-i64:32:64-f80:32:32-n8:16:32".to_string(),
llvm_target: "i686-unknown-linux-gnu".to_string(),
target_endian: "little".to_string(),
target_word_size: "32".to_string(),
target_pointer_width: "32".to_string(),
arch: "x86".to_string(),
target_os: "linux".to_string(),
options: base,
......
......@@ -19,7 +19,7 @@ pub fn target() -> Target {
-a:0:64-n32".to_string(),
llvm_target: "mips-unknown-linux-gnu".to_string(),
target_endian: "big".to_string(),
target_word_size: "32".to_string(),
target_pointer_width: "32".to_string(),
arch: "mips".to_string(),
target_os: "linux".to_string(),
options: super::linux_base::opts()
......
......@@ -19,7 +19,7 @@ pub fn target() -> Target {
-a:0:64-n32".to_string(),
llvm_target: "mipsel-unknown-linux-gnu".to_string(),
target_endian: "little".to_string(),
target_word_size: "32".to_string(),
target_pointer_width: "32".to_string(),
arch: "mips".to_string(),
target_os: "linux".to_string(),
......
......@@ -85,8 +85,8 @@ pub struct Target {
pub llvm_target: String,
/// String to use as the `target_endian` `cfg` variable.
pub target_endian: String,
/// String to use as the `target_word_size` `cfg` variable.
pub target_word_size: String,
/// String to use as the `target_pointer_width` `cfg` variable.
pub target_pointer_width: String,
/// OS name to use for conditional compilation.
pub target_os: String,
/// Architecture to use for ABI considerations. Valid options: "x86", "x86_64", "arm",
......@@ -233,7 +233,7 @@ pub fn from_json(obj: Json) -> Target {
data_layout: get_req_field("data-layout"),
llvm_target: get_req_field("llvm-target"),
target_endian: get_req_field("target-endian"),
target_word_size: get_req_field("target-word-size"),
target_pointer_width: get_req_field("target-word-size"),
arch: get_req_field("arch"),
target_os: get_req_field("os"),
options: Default::default(),
......
......@@ -21,7 +21,7 @@ pub fn target() -> Target {
s0:64:64-f80:128:128-n8:16:32:64".to_string(),
llvm_target: "x86_64-apple-darwin".to_string(),
target_endian: "little".to_string(),
target_word_size: "64".to_string(),
target_pointer_width: "64".to_string(),
arch: "x86_64".to_string(),
target_os: "macos".to_string(),
options: base,
......
......@@ -23,7 +23,7 @@ pub fn target() -> Target {
s0:64:64-f80:128:128-n8:16:32:64-S128".to_string(),
llvm_target: "x86_64-pc-windows-gnu".to_string(),
target_endian: "little".to_string(),
target_word_size: "64".to_string(),
target_pointer_width: "64".to_string(),
arch: "x86_64".to_string(),
target_os: "windows".to_string(),
options: base,
......
......@@ -20,7 +20,7 @@ pub fn target() -> Target {
s0:64:64-f80:128:128-n8:16:32:64-S128".to_string(),
llvm_target: "x86_64-unknown-dragonfly".to_string(),
target_endian: "little".to_string(),
target_word_size: "64".to_string(),
target_pointer_width: "64".to_string(),
arch: "x86_64".to_string(),
target_os: "dragonfly".to_string(),
options: base,
......
......@@ -20,7 +20,7 @@ pub fn target() -> Target {
s0:64:64-f80:128:128-n8:16:32:64-S128".to_string(),
llvm_target: "x86_64-unknown-freebsd".to_string(),
target_endian: "little".to_string(),
target_word_size: "64".to_string(),
target_pointer_width: "64".to_string(),
arch: "x86_64".to_string(),
target_os: "freebsd".to_string(),
options: base,
......
......@@ -20,7 +20,7 @@ pub fn target() -> Target {
s0:64:64-f80:128:128-n8:16:32:64-S128".to_string(),
llvm_target: "x86_64-unknown-linux-gnu".to_string(),
target_endian: "little".to_string(),
target_word_size: "64".to_string(),
target_pointer_width: "64".to_string(),
arch: "x86_64".to_string(),
target_os: "linux".to_string(),
options: base,
......
......@@ -1128,7 +1128,7 @@ pub fn call_lifetime_end(cx: Block, ptr: ValueRef) {
pub fn call_memcpy(cx: Block, dst: ValueRef, src: ValueRef, n_bytes: ValueRef, align: u32) {
let _icx = push_ctxt("call_memcpy");
let ccx = cx.ccx();
let key = match ccx.sess().target.target.target_word_size.index(&FullRange) {
let key = match ccx.sess().target.target.target_pointer_width.index(&FullRange) {
"32" => "llvm.memcpy.p0i8.p0i8.i32",
"64" => "llvm.memcpy.p0i8.p0i8.i64",
tws => panic!("Unsupported target word size for memcpy: {}", tws),
......@@ -1175,7 +1175,7 @@ fn memzero<'a, 'tcx>(b: &Builder<'a, 'tcx>, llptr: ValueRef, ty: Ty<'tcx>) {
let llty = type_of::type_of(ccx, ty);
let intrinsic_key = match ccx.sess().target.target.target_word_size.index(&FullRange) {
let intrinsic_key = match ccx.sess().target.target.target_pointer_width.index(&FullRange) {
"32" => "llvm.memset.p0i8.i32",
"64" => "llvm.memset.p0i8.i64",
tws => panic!("Unsupported target word size for memset: {}", tws),
......
......@@ -721,7 +721,7 @@ pub fn trait_cache(&self) -> &RefCell<FnvHashMap<ty::PolyTraitRef<'tcx>,
/// currently conservatively bounded to 1 << 47 as that is enough to cover the current usable
/// address space on 64-bit ARMv8 and x86_64.
pub fn obj_size_bound(&self) -> u64 {
match self.sess().target.target.target_word_size.index(&FullRange) {
match self.sess().target.target.target_pointer_width.index(&FullRange) {
"32" => 1 << 31,
"64" => 1 << 47,
_ => unreachable!() // error handled by config::build_target_config
......
......@@ -103,7 +103,7 @@ pub fn i8p(ccx: &CrateContext) -> Type {
}
pub fn int(ccx: &CrateContext) -> Type {
match ccx.tcx().sess.target.target.target_word_size.index(&FullRange) {
match ccx.tcx().sess.target.target.target_pointer_width.index(&FullRange) {
"32" => Type::i32(ccx),
"64" => Type::i64(ccx),
tws => panic!("Unsupported target word size for int: {}", tws),
......
......@@ -3481,7 +3481,7 @@ fn assert_stream_equal(src: &str,
}
}
#[test]
#[cfg_attr(target_word_size = "32", ignore)] // FIXME(#14064)
#[cfg_attr(target_pointer_width = "32", ignore)] // FIXME(#14064)
fn test_streaming_parser() {
assert_stream_equal(
r#"{ "foo":"bar", "array" : [0, 1, 2, 3, 4, 5], "idents":[null,true,false]}"#,
......@@ -3520,7 +3520,7 @@ fn last_event(src: &str) -> JsonEvent {
}
#[test]
#[cfg_attr(target_word_size = "32", ignore)] // FIXME(#14064)
#[cfg_attr(target_pointer_width = "32", ignore)] // FIXME(#14064)
fn test_read_object_streaming() {
assert_eq!(last_event("{ "), Error(SyntaxError(EOFWhileParsingObject, 1, 3)));
assert_eq!(last_event("{1"), Error(SyntaxError(KeyMustBeAString, 1, 2)));
......@@ -3604,7 +3604,7 @@ fn test_read_object_streaming() {
);
}
#[test]
#[cfg_attr(target_word_size = "32", ignore)] // FIXME(#14064)
#[cfg_attr(target_pointer_width = "32", ignore)] // FIXME(#14064)
fn test_read_array_streaming() {
assert_stream_equal(
"[]",
......
......@@ -424,12 +424,14 @@ fn test_cast_range_int_min() {
assert_eq!(int::MIN.to_u32(), None);
assert_eq!(int::MIN.to_u64(), None);
#[cfg(target_word_size = "32")]
#[cfg(any(all(stage0, target_word_size = "32"),
all(not(stage0), target_pointer_width = "32")))]
fn check_word_size() {
assert_eq!(int::MIN.to_i32(), Some(int::MIN as i32));
}
#[cfg(target_word_size = "64")]
#[cfg(any(all(stage0, target_word_size = "64"),
all(not(stage0), target_pointer_width = "64")))]
fn check_word_size() {
assert_eq!(int::MIN.to_i32(), None);
}
......@@ -492,12 +494,14 @@ fn test_cast_range_i64_min() {
assert_eq!(i64::MIN.to_u32(), None);
assert_eq!(i64::MIN.to_u64(), None);
#[cfg(target_word_size = "32")]
#[cfg(any(all(stage0, target_word_size = "32"),
all(not(stage0), target_pointer_width = "32")))]
fn check_word_size() {
assert_eq!(i64::MIN.to_int(), None);
}
#[cfg(target_word_size = "64")]
#[cfg(any(all(stage0, target_word_size = "64"),
all(not(stage0), target_pointer_width = "64")))]
fn check_word_size() {
assert_eq!(i64::MIN.to_int(), Some(i64::MIN as int));
}
......@@ -517,13 +521,15 @@ fn test_cast_range_int_max() {
// int::MAX.to_u32() is word-size specific
assert_eq!(int::MAX.to_u64(), Some(int::MAX as u64));
#[cfg(target_word_size = "32")]
#[cfg(any(all(stage0, target_word_size = "32"),
all(not(stage0), target_pointer_width = "32")))]
fn check_word_size() {
assert_eq!(int::MAX.to_i32(), Some(int::MAX as i32));
assert_eq!(int::MAX.to_u32(), Some(int::MAX as u32));
}
#[cfg(target_word_size = "64")]
#[cfg(any(all(stage0, target_word_size = "64"),
all(not(stage0), target_pointer_width = "64")))]
fn check_word_size() {
assert_eq!(int::MAX.to_i32(), None);
assert_eq!(int::MAX.to_u32(), None);
......@@ -587,13 +593,15 @@ fn test_cast_range_i64_max() {
assert_eq!(i64::MAX.to_u32(), None);
assert_eq!(i64::MAX.to_u64(), Some(i64::MAX as u64));
#[cfg(target_word_size = "32")]
#[cfg(any(all(stage0, target_word_size = "32"),
all(not(stage0), target_pointer_width = "32")))]
fn check_word_size() {
assert_eq!(i64::MAX.to_int(), None);
assert_eq!(i64::MAX.to_uint(), None);
}
#[cfg(target_word_size = "64")]
#[cfg(any(all(stage0, target_word_size = "64"),
all(not(stage0), target_pointer_width = "64")))]
fn check_word_size() {
assert_eq!(i64::MAX.to_int(), Some(i64::MAX as int));
assert_eq!(i64::MAX.to_uint(), Some(i64::MAX as uint));
......@@ -684,13 +692,15 @@ fn test_cast_range_uint_max() {
// uint::MAX.to_u32() is word-size specific
assert_eq!(uint::MAX.to_u64(), Some(uint::MAX as u64));
#[cfg(target_word_size = "32")]
#[cfg(any(all(stage0, target_word_size = "32"),
all(not(stage0), target_pointer_width = "32")))]
fn check_word_size() {
assert_eq!(uint::MAX.to_u32(), Some(uint::MAX as u32));
assert_eq!(uint::MAX.to_i64(), Some(uint::MAX as i64));
}
#[cfg(target_word_size = "64")]
#[cfg(any(all(stage0, target_word_size = "64"),
all(not(stage0), target_pointer_width = "64")))]
fn check_word_size() {
assert_eq!(uint::MAX.to_u32(), None);
assert_eq!(uint::MAX.to_i64(), None);
......@@ -740,12 +750,14 @@ fn test_cast_range_u32_max() {
assert_eq!(u32::MAX.to_u32(), Some(u32::MAX as u32));
assert_eq!(u32::MAX.to_u64(), Some(u32::MAX as u64));
#[cfg(target_word_size = "32")]
#[cfg(any(all(stage0, target_word_size = "32"),
all(not(stage0), target_pointer_width = "32")))]
fn check_word_size() {
assert_eq!(u32::MAX.to_int(), None);
}
#[cfg(target_word_size = "64")]
#[cfg(any(all(stage0, target_word_size = "64"),
all(not(stage0), target_pointer_width = "64")))]
fn check_word_size() {
assert_eq!(u32::MAX.to_int(), Some(u32::MAX as int));
}
......@@ -766,12 +778,14 @@ fn test_cast_range_u64_max() {
assert_eq!(u64::MAX.to_u32(), None);
assert_eq!(u64::MAX.to_u64(), Some(u64::MAX as u64));
#[cfg(target_word_size = "32")]
#[cfg(any(all(stage0, target_word_size = "32"),
all(not(stage0), target_pointer_width = "32")))]
fn check_word_size() {
assert_eq!(u64::MAX.to_uint(), None);
}
#[cfg(target_word_size = "64")]
#[cfg(any(all(stage0, target_word_size = "64"),
all(not(stage0), target_pointer_width = "64")))]
fn check_word_size() {
assert_eq!(u64::MAX.to_uint(), Some(u64::MAX as uint));
}
......
......@@ -230,9 +230,9 @@
use result::Result::{Ok, Err};
use vec::Vec;
#[cfg(not(target_word_size="64"))]
#[cfg(any(all(stage0, target_word_size = "32"), all(not(stage0), target_pointer_width = "32")))]
use core_rand::IsaacRng as IsaacWordRng;
#[cfg(target_word_size="64")]
#[cfg(any(all(stage0, target_word_size = "64"), all(not(stage0), target_pointer_width = "64")))]
use core_rand::Isaac64Rng as IsaacWordRng;
pub use core_rand::{Rand, Rng, SeedableRng, Open01, Closed01};
......
......@@ -12,8 +12,11 @@
use io::IoResult;
#[cfg(target_word_size = "64")] pub const HEX_WIDTH: uint = 18;
#[cfg(target_word_size = "32")] pub const HEX_WIDTH: uint = 10;
#[cfg(any(all(stage0, target_word_size = "64"), all(not(stage0), target_pointer_width = "64")))]
pub const HEX_WIDTH: uint = 18;
#[cfg(any(all(stage0, target_word_size = "32"), all(not(stage0), target_pointer_width = "32")))]
pub const HEX_WIDTH: uint = 10;
// All rust symbols are in theory lists of "::"-separated identifiers. Some
// assemblers, however, can't handle these characters in symbol names. To get
......
......@@ -169,13 +169,13 @@ unsafe impl ::marker::Send for sigaction { }
unsafe impl ::marker::Sync for sigaction { }
#[repr(C)]
#[cfg(target_word_size = "32")]
#[cfg(any(all(stage0, target_word_size = "32"), all(not(stage0), target_pointer_width = "32")))]
pub struct sigset_t {
__val: [libc::c_ulong; 32],
}
#[repr(C)]
#[cfg(target_word_size = "64")]
#[cfg(any(all(stage0, target_word_size = "64"), all(not(stage0), target_pointer_width = "64")))]
pub struct sigset_t {
__val: [libc::c_ulong; 16],
}
......
......@@ -182,12 +182,14 @@ pub struct sigaction {
sa_restorer: *mut libc::c_void,
}
#[cfg(target_word_size = "32")]
#[cfg(any(all(stage0, target_word_size = "32"),
all(not(stage0), target_pointer_width = "32")))]
#[repr(C)]
pub struct sigset_t {
__val: [libc::c_ulong; 32],
}
#[cfg(target_word_size = "64")]
#[cfg(any(all(stage0, target_word_size = "64"),
all(not(stage0), target_pointer_width = "64")))]
#[repr(C)]
pub struct sigset_t {
__val: [libc::c_ulong; 16],
......
......@@ -12,12 +12,12 @@
// FIXME: work properly with higher limits
#[cfg(target_word_size = "32")]
#[cfg(any(all(stage0, target_word_size = "32"), all(not(stage0), target_pointer_width = "32")))]
fn main() {
let big: Option<[u32; (1<<29)-1]> = None;
}
#[cfg(target_word_size = "64")]
#[cfg(any(all(stage0, target_word_size = "64"), all(not(stage0), target_pointer_width = "64")))]
fn main() {
let big: Option<[u32; (1<<45)-1]> = None;
}
......@@ -10,14 +10,14 @@
// error-pattern: too big for the current architecture
#[cfg(target_word_size = "64")]
#[cfg(any(all(stage0, target_word_size = "64"), all(not(stage0), target_pointer_width = "64")))]
fn main() {
let n = 0u;
let a = box [&n; 0xF000000000000000u];
println!("{}", a[0xFFFFFFu]);
}
#[cfg(target_word_size = "32")]
#[cfg(any(all(stage0, target_word_size = "32"), all(not(stage0), target_pointer_width = "32")))]
fn main() {
let n = 0u;
let a = box [&n; 0xFFFFFFFFu];
......
......@@ -10,12 +10,12 @@
use std::mem::size_of;
#[cfg(target_word_size = "32")]
#[cfg(any(all(stage0, target_word_size = "32"), all(not(stage0), target_pointer_width = "32")))]
pub fn main() {
assert_eq!(size_of::<[u8; (1 << 31) - 1]>(), (1 << 31) - 1);
}
#[cfg(target_word_size = "64")]
#[cfg(any(all(stage0, target_word_size = "64"), all(not(stage0), target_pointer_width = "64")))]
pub fn main() {
assert_eq!(size_of::<[u8; (1 << 47) - 1]>(), (1 << 47) - 1);
}
......@@ -21,7 +21,7 @@ pub fn main() {
// FIXME #10183
// FIXME #18069
//if cfg!(target_word_size = "64") {
//if cfg!(target_pointer_width = "64") {
// assert_eq!(size_of::<[u8; (1 << 32)]>(), (1u << 32));
//}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册