about summary refs log tree commit diff
path: root/src/libcore/num
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2015-04-03 04:29:52 +0000
committerbors <bors@rust-lang.org>2015-04-03 04:29:52 +0000
commitfc98b19cf72ea45851ebb7b28af160be92b19128 (patch)
tree8a19d8c1f6e9a71eb5e0286954519b4b7ec3fbf8 /src/libcore/num
parent5e30f05a05326018357c6fffdfb872e8a8d2367c (diff)
parent883adc6763c3dd06b282368698b28a07cdd65fd6 (diff)
downloadrust-fc98b19cf72ea45851ebb7b28af160be92b19128.tar.gz
rust-fc98b19cf72ea45851ebb7b28af160be92b19128.zip
Auto merge of #23832 - petrochenkov:usize, r=aturon
These constants are small and can fit even in `u8`, but semantically they have type `usize` because they denote sizes and are almost always used in `usize` context. The change of their type to `u32` during the integer audit led only to the large amount of `as usize` noise (see the second commit, which removes this noise).

This is a minor [breaking-change] to an unstable interface.

r? @aturon 

Diffstat (limited to 'src/libcore/num')
-rw-r--r--src/libcore/num/int_macros.rs4
-rw-r--r--src/libcore/num/uint_macros.rs4
2 files changed, 4 insertions, 4 deletions
diff --git a/src/libcore/num/int_macros.rs b/src/libcore/num/int_macros.rs
index fe0d6d13c4c..3113521e0af 100644
--- a/src/libcore/num/int_macros.rs
+++ b/src/libcore/num/int_macros.rs
@@ -15,11 +15,11 @@ macro_rules! int_module { ($T:ty, $bits:expr) => (
 // FIXME(#11621): Should be deprecated once CTFE is implemented in favour of
 // calling the `mem::size_of` function.
 #[unstable(feature = "core")]
-pub const BITS : u32 = $bits;
+pub const BITS : usize = $bits;
 // FIXME(#11621): Should be deprecated once CTFE is implemented in favour of
 // calling the `mem::size_of` function.
 #[unstable(feature = "core")]
-pub const BYTES : u32 = ($bits / 8);
+pub const BYTES : usize = ($bits / 8);
 
 // FIXME(#11621): Should be deprecated once CTFE is implemented in favour of
 // calling the `Bounded::min_value` function.
diff --git a/src/libcore/num/uint_macros.rs b/src/libcore/num/uint_macros.rs
index d0c4885ad00..86782950745 100644
--- a/src/libcore/num/uint_macros.rs
+++ b/src/libcore/num/uint_macros.rs
@@ -13,9 +13,9 @@
 macro_rules! uint_module { ($T:ty, $T_SIGNED:ty, $bits:expr) => (
 
 #[unstable(feature = "core")]
-pub const BITS : u32 = $bits;
+pub const BITS : usize = $bits;
 #[unstable(feature = "core")]
-pub const BYTES : u32 = ($bits / 8);
+pub const BYTES : usize = ($bits / 8);
 
 #[stable(feature = "rust1", since = "1.0.0")]
 pub const MIN: $T = 0 as $T;