about summary refs log tree commit diff
path: root/src/libcollections/enum_set.rs
diff options
context:
space:
mode:
authorBrian Anderson <banderson@mozilla.com>2015-02-19 21:05:35 -0800
committerBrian Anderson <banderson@mozilla.com>2015-03-02 16:12:46 -0800
commit76e9fa63ba0b6d892aa880db9c8373ede3e67c03 (patch)
tree5c932ad4ef0079ca1f4a8b3d0767f7e5984df2a5 /src/libcollections/enum_set.rs
parent2ca6eaedae9ec4bff2a63f81f473aba653e46ac5 (diff)
downloadrust-76e9fa63ba0b6d892aa880db9c8373ede3e67c03.tar.gz
rust-76e9fa63ba0b6d892aa880db9c8373ede3e67c03.zip
core: Audit num module for int/uint
* count_ones/zeros, trailing_ones/zeros return u32, not usize
* rotate_left/right take u32, not usize
* RADIX, MANTISSA_DIGITS, DIGITS, BITS, BYTES are u32, not usize

Doesn't touch pow because there's another PR for it.

[breaking-change]
Diffstat (limited to 'src/libcollections/enum_set.rs')
-rw-r--r--src/libcollections/enum_set.rs6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/libcollections/enum_set.rs b/src/libcollections/enum_set.rs
index 62dd9191521..4c966c0d44b 100644
--- a/src/libcollections/enum_set.rs
+++ b/src/libcollections/enum_set.rs
@@ -78,7 +78,7 @@ pub trait CLike {
 fn bit<E:CLike>(e: &E) -> usize {
     use core::usize;
     let value = e.to_usize();
-    assert!(value < usize::BITS,
+    assert!(value < usize::BITS as usize,
             "EnumSet only supports up to {} variants.", usize::BITS - 1);
     1 << value
 }
@@ -95,7 +95,7 @@ impl<E:CLike> EnumSet<E> {
     #[unstable(feature = "collections",
                reason = "matches collection reform specification, waiting for dust to settle")]
     pub fn len(&self) -> usize {
-        self.bits.count_ones()
+        self.bits.count_ones() as usize
     }
 
     /// Returns true if the `EnumSet` is empty.
@@ -250,7 +250,7 @@ impl<E:CLike> Iterator for Iter<E> {
     }
 
     fn size_hint(&self) -> (usize, Option<usize>) {
-        let exact = self.bits.count_ones();
+        let exact = self.bits.count_ones() as usize;
         (exact, Some(exact))
     }
 }