Skip to content

Commit dd3e89a

Browse files
committed
Rename target_word_size to target_pointer_width
Closes #20421 [breaking-change]
1 parent 9f1ead8 commit dd3e89a

36 files changed

+91
-69
lines changed

Diff for: src/libcore/iter.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -2749,9 +2749,9 @@ macro_rules! step_impl_no_between {
27492749
}
27502750

27512751
step_impl!(uint u8 u16 u32 int i8 i16 i32);
2752-
#[cfg(target_word_size = "64")]
2752+
#[cfg(any(all(stage0, target_word_size = "64"), all(not(stage0), target_pointer_width = "64")))]
27532753
step_impl!(u64 i64);
2754-
#[cfg(target_word_size = "32")]
2754+
#[cfg(any(all(stage0, target_word_size = "32"), all(not(stage0), target_pointer_width = "32")))]
27552755
step_impl_no_between!(u64 i64);
27562756

27572757

Diff for: src/libcore/num/int.rs

+5-2
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,8 @@
1313
#![stable]
1414
#![doc(primitive = "int")]
1515

16-
#[cfg(target_word_size = "32")] int_module! { int, 32 }
17-
#[cfg(target_word_size = "64")] int_module! { int, 64 }
16+
#[cfg(stage0)] #[cfg(target_word_size = "32")] int_module! { int, 32 }
17+
#[cfg(stage0)] #[cfg(target_word_size = "64")] int_module! { int, 64 }
18+
19+
#[cfg(not(stage0))] #[cfg(target_pointer_width = "32")] int_module! { int, 32 }
20+
#[cfg(not(stage0))] #[cfg(target_pointer_width = "64")] int_module! { int, 64 }

Diff for: src/libcore/num/mod.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -496,7 +496,7 @@ uint_impl! { u64 = u64, 64,
496496
intrinsics::u64_sub_with_overflow,
497497
intrinsics::u64_mul_with_overflow }
498498

499-
#[cfg(target_word_size = "32")]
499+
#[cfg(any(all(stage0, target_word_size = "32"), all(not(stage0), target_pointer_width = "32")))]
500500
uint_impl! { uint = u32, 32,
501501
intrinsics::ctpop32,
502502
intrinsics::ctlz32,
@@ -506,7 +506,7 @@ uint_impl! { uint = u32, 32,
506506
intrinsics::u32_sub_with_overflow,
507507
intrinsics::u32_mul_with_overflow }
508508

509-
#[cfg(target_word_size = "64")]
509+
#[cfg(any(all(stage0, target_word_size = "64"), all(not(stage0), target_pointer_width = "64")))]
510510
uint_impl! { uint = u64, 64,
511511
intrinsics::ctpop64,
512512
intrinsics::ctlz64,
@@ -601,13 +601,13 @@ int_impl! { i64 = i64, u64, 64,
601601
intrinsics::i64_sub_with_overflow,
602602
intrinsics::i64_mul_with_overflow }
603603

604-
#[cfg(target_word_size = "32")]
604+
#[cfg(any(all(stage0, target_word_size = "32"), all(not(stage0), target_pointer_width = "32")))]
605605
int_impl! { int = i32, u32, 32,
606606
intrinsics::i32_add_with_overflow,
607607
intrinsics::i32_sub_with_overflow,
608608
intrinsics::i32_mul_with_overflow }
609609

610-
#[cfg(target_word_size = "64")]
610+
#[cfg(any(all(stage0, target_word_size = "64"), all(not(stage0), target_pointer_width = "64")))]
611611
int_impl! { int = i64, u64, 64,
612612
intrinsics::i64_add_with_overflow,
613613
intrinsics::i64_sub_with_overflow,

Diff for: src/librustc/metadata/filesearch.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -272,12 +272,12 @@ fn find_libdir(sysroot: &Path) -> String {
272272
}
273273
}
274274

275-
#[cfg(target_word_size = "64")]
275+
#[cfg(any(all(stage0, target_word_size = "64"), all(not(stage0), target_pointer_width = "64")))]
276276
fn primary_libdir_name() -> String {
277277
"lib64".to_string()
278278
}
279279

280-
#[cfg(target_word_size = "32")]
280+
#[cfg(any(all(stage0, target_word_size = "32"), all(not(stage0), target_pointer_width = "32")))]
281281
fn primary_libdir_name() -> String {
282282
"lib32".to_string()
283283
}

Diff for: src/librustc/session/config.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -594,7 +594,7 @@ pub fn default_configuration(sess: &Session) -> ast::CrateConfig {
594594

595595
let end = sess.target.target.target_endian.index(&FullRange);
596596
let arch = sess.target.target.arch.index(&FullRange);
597-
let wordsz = sess.target.target.target_word_size.index(&FullRange);
597+
let wordsz = sess.target.target.target_pointer_width.index(&FullRange);
598598
let os = sess.target.target.target_os.index(&FullRange);
599599

600600
let fam = match sess.target.target.options.is_like_windows {
@@ -609,7 +609,7 @@ pub fn default_configuration(sess: &Session) -> ast::CrateConfig {
609609
mk(InternedString::new("target_family"), fam),
610610
mk(InternedString::new("target_arch"), intern(arch)),
611611
mk(InternedString::new("target_endian"), intern(end)),
612-
mk(InternedString::new("target_word_size"),
612+
mk(InternedString::new("target_pointer_width"),
613613
intern(wordsz))
614614
);
615615
}
@@ -643,7 +643,7 @@ pub fn build_target_config(opts: &Options, sp: &SpanHandler) -> Config {
643643
}
644644
};
645645

646-
let (int_type, uint_type) = match target.target_word_size.index(&FullRange) {
646+
let (int_type, uint_type) = match target.target_pointer_width.index(&FullRange) {
647647
"32" => (ast::TyI32, ast::TyU32),
648648
"64" => (ast::TyI64, ast::TyU64),
649649
w => sp.handler().fatal((format!("target specification was invalid: unrecognized \

Diff for: src/librustc_back/target/aarch64_unknown_linux_gnu.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ pub fn target() -> Target {
1818
n32:64-S128".to_string(),
1919
llvm_target: "aarch64-unknown-linux-gnu".to_string(),
2020
target_endian: "little".to_string(),
21-
target_word_size: "64".to_string(),
21+
target_pointer_width: "64".to_string(),
2222
arch: "aarch64".to_string(),
2323
target_os: "linux".to_string(),
2424
options: base,

Diff for: src/librustc_back/target/arm_apple_ios.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ pub fn target() -> Target {
1919
-a:0:64-n32".to_string(),
2020
llvm_target: "arm-apple-ios".to_string(),
2121
target_endian: "little".to_string(),
22-
target_word_size: "32".to_string(),
22+
target_pointer_width: "32".to_string(),
2323
arch: "arm".to_string(),
2424
target_os: "ios".to_string(),
2525
options: TargetOptions {

Diff for: src/librustc_back/target/arm_linux_androideabi.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ pub fn target() -> Target {
2727
-a:0:64-n32".to_string(),
2828
llvm_target: "arm-linux-androideabi".to_string(),
2929
target_endian: "little".to_string(),
30-
target_word_size: "32".to_string(),
30+
target_pointer_width: "32".to_string(),
3131
arch: "arm".to_string(),
3232
target_os: "android".to_string(),
3333
options: base,

Diff for: src/librustc_back/target/arm_unknown_linux_gnueabi.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ pub fn target() -> Target {
2020
-a:0:64-n32".to_string(),
2121
llvm_target: "arm-unknown-linux-gnueabi".to_string(),
2222
target_endian: "little".to_string(),
23-
target_word_size: "32".to_string(),
23+
target_pointer_width: "32".to_string(),
2424
arch: "arm".to_string(),
2525
target_os: "linux".to_string(),
2626

Diff for: src/librustc_back/target/arm_unknown_linux_gnueabihf.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ pub fn target() -> Target {
2020
-a:0:64-n32".to_string(),
2121
llvm_target: "arm-unknown-linux-gnueabihf".to_string(),
2222
target_endian: "little".to_string(),
23-
target_word_size: "32".to_string(),
23+
target_pointer_width: "32".to_string(),
2424
arch: "arm".to_string(),
2525
target_os: "linux".to_string(),
2626

Diff for: src/librustc_back/target/i386_apple_ios.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ pub fn target() -> Target {
1919
-n8:16:32".to_string(),
2020
llvm_target: "i386-apple-ios".to_string(),
2121
target_endian: "little".to_string(),
22-
target_word_size: "32".to_string(),
22+
target_pointer_width: "32".to_string(),
2323
arch: "x86".to_string(),
2424
target_os: "ios".to_string(),
2525

Diff for: src/librustc_back/target/i686_apple_darwin.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ pub fn target() -> Target {
2222
-n8:16:32".to_string(),
2323
llvm_target: "i686-apple-darwin".to_string(),
2424
target_endian: "little".to_string(),
25-
target_word_size: "32".to_string(),
25+
target_pointer_width: "32".to_string(),
2626
arch: "x86".to_string(),
2727
target_os: "macos".to_string(),
2828
options: base,

Diff for: src/librustc_back/target/i686_pc_windows_gnu.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ pub fn target() -> Target {
2626
data_layout: "e-p:32:32-f64:64:64-i64:64:64-f80:32:32-n8:16:32".to_string(),
2727
llvm_target: "i686-pc-windows-gnu".to_string(),
2828
target_endian: "little".to_string(),
29-
target_word_size: "32".to_string(),
29+
target_pointer_width: "32".to_string(),
3030
arch: "x86".to_string(),
3131
target_os: "windows".to_string(),
3232
options: options,

Diff for: src/librustc_back/target/i686_unknown_dragonfly.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ pub fn target() -> Target {
1818
data_layout: "e-p:32:32-f64:32:64-i64:32:64-f80:32:32-n8:16:32".to_string(),
1919
llvm_target: "i686-unknown-dragonfly".to_string(),
2020
target_endian: "little".to_string(),
21-
target_word_size: "32".to_string(),
21+
target_pointer_width: "32".to_string(),
2222
arch: "x86".to_string(),
2323
target_os: "dragonfly".to_string(),
2424
options: base,

Diff for: src/librustc_back/target/i686_unknown_linux_gnu.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ pub fn target() -> Target {
1818
data_layout: "e-p:32:32-f64:32:64-i64:32:64-f80:32:32-n8:16:32".to_string(),
1919
llvm_target: "i686-unknown-linux-gnu".to_string(),
2020
target_endian: "little".to_string(),
21-
target_word_size: "32".to_string(),
21+
target_pointer_width: "32".to_string(),
2222
arch: "x86".to_string(),
2323
target_os: "linux".to_string(),
2424
options: base,

Diff for: src/librustc_back/target/mips_unknown_linux_gnu.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ pub fn target() -> Target {
1919
-a:0:64-n32".to_string(),
2020
llvm_target: "mips-unknown-linux-gnu".to_string(),
2121
target_endian: "big".to_string(),
22-
target_word_size: "32".to_string(),
22+
target_pointer_width: "32".to_string(),
2323
arch: "mips".to_string(),
2424
target_os: "linux".to_string(),
2525
options: super::linux_base::opts()

Diff for: src/librustc_back/target/mipsel_unknown_linux_gnu.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ pub fn target() -> Target {
1919
-a:0:64-n32".to_string(),
2020
llvm_target: "mipsel-unknown-linux-gnu".to_string(),
2121
target_endian: "little".to_string(),
22-
target_word_size: "32".to_string(),
22+
target_pointer_width: "32".to_string(),
2323
arch: "mips".to_string(),
2424
target_os: "linux".to_string(),
2525

Diff for: src/librustc_back/target/mod.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,8 @@ pub struct Target {
8585
pub llvm_target: String,
8686
/// String to use as the `target_endian` `cfg` variable.
8787
pub target_endian: String,
88-
/// String to use as the `target_word_size` `cfg` variable.
89-
pub target_word_size: String,
88+
/// String to use as the `target_pointer_width` `cfg` variable.
89+
pub target_pointer_width: String,
9090
/// OS name to use for conditional compilation.
9191
pub target_os: String,
9292
/// Architecture to use for ABI considerations. Valid options: "x86", "x86_64", "arm",
@@ -233,7 +233,7 @@ impl Target {
233233
data_layout: get_req_field("data-layout"),
234234
llvm_target: get_req_field("llvm-target"),
235235
target_endian: get_req_field("target-endian"),
236-
target_word_size: get_req_field("target-word-size"),
236+
target_pointer_width: get_req_field("target-word-size"),
237237
arch: get_req_field("arch"),
238238
target_os: get_req_field("os"),
239239
options: Default::default(),

Diff for: src/librustc_back/target/x86_64_apple_darwin.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ pub fn target() -> Target {
2121
s0:64:64-f80:128:128-n8:16:32:64".to_string(),
2222
llvm_target: "x86_64-apple-darwin".to_string(),
2323
target_endian: "little".to_string(),
24-
target_word_size: "64".to_string(),
24+
target_pointer_width: "64".to_string(),
2525
arch: "x86_64".to_string(),
2626
target_os: "macos".to_string(),
2727
options: base,

Diff for: src/librustc_back/target/x86_64_pc_windows_gnu.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ pub fn target() -> Target {
2323
s0:64:64-f80:128:128-n8:16:32:64-S128".to_string(),
2424
llvm_target: "x86_64-pc-windows-gnu".to_string(),
2525
target_endian: "little".to_string(),
26-
target_word_size: "64".to_string(),
26+
target_pointer_width: "64".to_string(),
2727
arch: "x86_64".to_string(),
2828
target_os: "windows".to_string(),
2929
options: base,

Diff for: src/librustc_back/target/x86_64_unknown_dragonfly.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ pub fn target() -> Target {
2020
s0:64:64-f80:128:128-n8:16:32:64-S128".to_string(),
2121
llvm_target: "x86_64-unknown-dragonfly".to_string(),
2222
target_endian: "little".to_string(),
23-
target_word_size: "64".to_string(),
23+
target_pointer_width: "64".to_string(),
2424
arch: "x86_64".to_string(),
2525
target_os: "dragonfly".to_string(),
2626
options: base,

Diff for: src/librustc_back/target/x86_64_unknown_freebsd.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ pub fn target() -> Target {
2020
s0:64:64-f80:128:128-n8:16:32:64-S128".to_string(),
2121
llvm_target: "x86_64-unknown-freebsd".to_string(),
2222
target_endian: "little".to_string(),
23-
target_word_size: "64".to_string(),
23+
target_pointer_width: "64".to_string(),
2424
arch: "x86_64".to_string(),
2525
target_os: "freebsd".to_string(),
2626
options: base,

Diff for: src/librustc_back/target/x86_64_unknown_linux_gnu.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ pub fn target() -> Target {
2020
s0:64:64-f80:128:128-n8:16:32:64-S128".to_string(),
2121
llvm_target: "x86_64-unknown-linux-gnu".to_string(),
2222
target_endian: "little".to_string(),
23-
target_word_size: "64".to_string(),
23+
target_pointer_width: "64".to_string(),
2424
arch: "x86_64".to_string(),
2525
target_os: "linux".to_string(),
2626
options: base,

Diff for: src/librustc_trans/trans/base.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1128,7 +1128,7 @@ pub fn call_lifetime_end(cx: Block, ptr: ValueRef) {
11281128
pub fn call_memcpy(cx: Block, dst: ValueRef, src: ValueRef, n_bytes: ValueRef, align: u32) {
11291129
let _icx = push_ctxt("call_memcpy");
11301130
let ccx = cx.ccx();
1131-
let key = match ccx.sess().target.target.target_word_size.index(&FullRange) {
1131+
let key = match ccx.sess().target.target.target_pointer_width.index(&FullRange) {
11321132
"32" => "llvm.memcpy.p0i8.p0i8.i32",
11331133
"64" => "llvm.memcpy.p0i8.p0i8.i64",
11341134
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>) {
11751175

11761176
let llty = type_of::type_of(ccx, ty);
11771177

1178-
let intrinsic_key = match ccx.sess().target.target.target_word_size.index(&FullRange) {
1178+
let intrinsic_key = match ccx.sess().target.target.target_pointer_width.index(&FullRange) {
11791179
"32" => "llvm.memset.p0i8.i32",
11801180
"64" => "llvm.memset.p0i8.i64",
11811181
tws => panic!("Unsupported target word size for memset: {}", tws),

Diff for: src/librustc_trans/trans/context.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -721,7 +721,7 @@ impl<'b, 'tcx> CrateContext<'b, 'tcx> {
721721
/// currently conservatively bounded to 1 << 47 as that is enough to cover the current usable
722722
/// address space on 64-bit ARMv8 and x86_64.
723723
pub fn obj_size_bound(&self) -> u64 {
724-
match self.sess().target.target.target_word_size.index(&FullRange) {
724+
match self.sess().target.target.target_pointer_width.index(&FullRange) {
725725
"32" => 1 << 31,
726726
"64" => 1 << 47,
727727
_ => unreachable!() // error handled by config::build_target_config

Diff for: src/librustc_trans/trans/type_.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ impl Type {
103103
}
104104

105105
pub fn int(ccx: &CrateContext) -> Type {
106-
match ccx.tcx().sess.target.target.target_word_size.index(&FullRange) {
106+
match ccx.tcx().sess.target.target.target_pointer_width.index(&FullRange) {
107107
"32" => Type::i32(ccx),
108108
"64" => Type::i64(ccx),
109109
tws => panic!("Unsupported target word size for int: {}", tws),

Diff for: src/libserialize/json.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -3481,7 +3481,7 @@ mod tests {
34813481
}
34823482
}
34833483
#[test]
3484-
#[cfg_attr(target_word_size = "32", ignore)] // FIXME(#14064)
3484+
#[cfg_attr(target_pointer_width = "32", ignore)] // FIXME(#14064)
34853485
fn test_streaming_parser() {
34863486
assert_stream_equal(
34873487
r#"{ "foo":"bar", "array" : [0, 1, 2, 3, 4, 5], "idents":[null,true,false]}"#,
@@ -3520,7 +3520,7 @@ mod tests {
35203520
}
35213521

35223522
#[test]
3523-
#[cfg_attr(target_word_size = "32", ignore)] // FIXME(#14064)
3523+
#[cfg_attr(target_pointer_width = "32", ignore)] // FIXME(#14064)
35243524
fn test_read_object_streaming() {
35253525
assert_eq!(last_event("{ "), Error(SyntaxError(EOFWhileParsingObject, 1, 3)));
35263526
assert_eq!(last_event("{1"), Error(SyntaxError(KeyMustBeAString, 1, 2)));
@@ -3604,7 +3604,7 @@ mod tests {
36043604
);
36053605
}
36063606
#[test]
3607-
#[cfg_attr(target_word_size = "32", ignore)] // FIXME(#14064)
3607+
#[cfg_attr(target_pointer_width = "32", ignore)] // FIXME(#14064)
36083608
fn test_read_array_streaming() {
36093609
assert_stream_equal(
36103610
"[]",

0 commit comments

Comments
 (0)