about summary refs log tree commit diff
path: root/src/libstd/num
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2015-01-08 05:35:51 +0000
committerbors <bors@rust-lang.org>2015-01-08 05:35:51 +0000
commit5b3cd3900ceda838f5798c30ab96ceb41f962534 (patch)
tree7593bacffb7c8111eee7fa2a0a05d0357ccba763 /src/libstd/num
parent9f1ead8fadc56bad30dc74f5cc50d78af4fbc972 (diff)
parent0abf4583486071a958aa1bd14ab8c5b8870fb74d (diff)
auto merge of #20733 : alexcrichton/rust/rollup, r=alexcrichton
Diffstat (limited to 'src/libstd/num')
-rw-r--r--src/libstd/num/int.rs9
-rw-r--r--src/libstd/num/isize.rs22
-rw-r--r--src/libstd/num/mod.rs42
-rw-r--r--src/libstd/num/uint.rs9
-rw-r--r--src/libstd/num/usize.rs22
5 files changed, 84 insertions, 20 deletions
diff --git a/src/libstd/num/int.rs b/src/libstd/num/int.rs
index 9ccb1544fdc..69439f85115 100644
--- a/src/libstd/num/int.rs
+++ b/src/libstd/num/int.rs
@@ -8,10 +8,13 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-//! Operations and constants for architecture-sized signed integers (`int` type)
+//! Deprecated: replaced by `isize`.
+//!
+//! The rollout of the new type will gradually take place over the
+//! alpha cycle along with the development of clearer conventions
+//! around integer types.
 
-#![stable]
-#![doc(primitive = "int")]
+#![deprecated = "replaced by isize"]
 
 pub use core::int::{BITS, BYTES, MIN, MAX};
 
diff --git a/src/libstd/num/isize.rs b/src/libstd/num/isize.rs
new file mode 100644
index 00000000000..22395a1c0ff
--- /dev/null
+++ b/src/libstd/num/isize.rs
@@ -0,0 +1,22 @@
+// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+//! Operations and constants for pointer-sized signed integers (`isize` type)
+//!
+//! This type was recently added to replace `int`. The rollout of the
+//! new type will gradually take place over the alpha cycle along with
+//! the development of clearer conventions around integer types.
+
+#![stable]
+#![doc(primitive = "isize")]
+
+pub use core::isize::{BITS, BYTES, MIN, MAX};
+
+int_module! { isize }
diff --git a/src/libstd/num/mod.rs b/src/libstd/num/mod.rs
index f433cd1e664..9c6911cf4d1 100644
--- a/src/libstd/num/mod.rs
+++ b/src/libstd/num/mod.rs
@@ -424,12 +424,14 @@ mod tests {
         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 @@ mod tests {
         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 @@ mod tests {
         // 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 @@ mod tests {
         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 @@ mod tests {
         // 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 @@ mod tests {
         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 @@ mod tests {
         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));
         }
diff --git a/src/libstd/num/uint.rs b/src/libstd/num/uint.rs
index 0fbc0953b20..0e12eff205f 100644
--- a/src/libstd/num/uint.rs
+++ b/src/libstd/num/uint.rs
@@ -8,10 +8,13 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-//! Operations and constants for architecture-sized unsigned integers (`uint` type)
+//! Deprecated: replaced by `usize`.
+//!
+//! The rollout of the new type will gradually take place over the
+//! alpha cycle along with the development of clearer conventions
+//! around integer types.
 
-#![stable]
-#![doc(primitive = "uint")]
+#![deprecated = "replaced by usize"]
 
 pub use core::uint::{BITS, BYTES, MIN, MAX};
 
diff --git a/src/libstd/num/usize.rs b/src/libstd/num/usize.rs
new file mode 100644
index 00000000000..74dd38e13c5
--- /dev/null
+++ b/src/libstd/num/usize.rs
@@ -0,0 +1,22 @@
+// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+//! Operations and constants for pointer-sized unsigned integers (`usize` type)
+//!
+//! This type was recently added to replace `uint`. The rollout of the
+//! new type will gradually take place over the alpha cycle along with
+//! the development of clearer conventions around integer types.
+
+#![stable]
+#![doc(primitive = "usize")]
+
+pub use core::usize::{BITS, BYTES, MIN, MAX};
+
+uint_module! { usize }