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

src/libcore/iter.rs

Lines changed: 2 additions & 2 deletions
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

src/libcore/num/int.rs

Lines changed: 5 additions & 2 deletions
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 }

src/libcore/num/mod.rs

Lines changed: 4 additions & 4 deletions
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,

src/librustc/metadata/filesearch.rs

Lines changed: 2 additions & 2 deletions
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
}

src/librustc/session/config.rs

Lines changed: 3 additions & 3 deletions
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 \

src/librustc_back/target/aarch64_unknown_linux_gnu.rs

Lines changed: 1 addition & 1 deletion
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,

src/librustc_back/target/arm_apple_ios.rs

Lines changed: 1 addition & 1 deletion
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 {

src/librustc_back/target/arm_linux_androideabi.rs

Lines changed: 1 addition & 1 deletion
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,

src/librustc_back/target/arm_unknown_linux_gnueabi.rs

Lines changed: 1 addition & 1 deletion
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

src/librustc_back/target/arm_unknown_linux_gnueabihf.rs

Lines changed: 1 addition & 1 deletion
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

0 commit comments

Comments
 (0)