about summary refs log tree commit diff
path: root/src/libcollections
diff options
context:
space:
mode:
authorPatrick Walton <pcwalton@mimiga.net>2014-06-27 12:30:25 -0700
committerPatrick Walton <pcwalton@mimiga.net>2014-06-29 11:47:58 -0700
commita5bb0a3a4574af88add700ace7aefc37172fa7a5 (patch)
tree5c2505254a2fdc396d600807b071c00b064c18b7 /src/libcollections
parentbd9563aa382ccfbda36049786329edcdc609930c (diff)
downloadrust-a5bb0a3a4574af88add700ace7aefc37172fa7a5.tar.gz
rust-a5bb0a3a4574af88add700ace7aefc37172fa7a5.zip
librustc: Remove the fallback to `int` for integers and `f64` for
floating point numbers for real.

This will break code that looks like:

    let mut x = 0;
    while ... {
        x += 1;
    }
    println!("{}", x);

Change that code to:

    let mut x = 0i;
    while ... {
        x += 1;
    }
    println!("{}", x);

Closes #15201.

[breaking-change]
Diffstat (limited to 'src/libcollections')
-rw-r--r--src/libcollections/hash/mod.rs4
-rw-r--r--src/libcollections/ringbuf.rs10
-rw-r--r--src/libcollections/slice.rs22
-rw-r--r--src/libcollections/str.rs8
4 files changed, 22 insertions, 22 deletions
diff --git a/src/libcollections/hash/mod.rs b/src/libcollections/hash/mod.rs
index 976f7262441..e3d1c9a3216 100644
--- a/src/libcollections/hash/mod.rs
+++ b/src/libcollections/hash/mod.rs
@@ -342,12 +342,12 @@ mod tests {
         assert_eq!(hasher.hash(& &[1u8, 2u8, 3u8]), 9);
 
         unsafe {
-            let ptr: *const int = mem::transmute(5);
+            let ptr: *const int = mem::transmute(5i);
             assert_eq!(hasher.hash(&ptr), 5);
         }
 
         unsafe {
-            let ptr: *mut int = mem::transmute(5);
+            let ptr: *mut int = mem::transmute(5i);
             assert_eq!(hasher.hash(&ptr), 5);
         }
     }
diff --git a/src/libcollections/ringbuf.rs b/src/libcollections/ringbuf.rs
index be0d603696b..5e19accdd67 100644
--- a/src/libcollections/ringbuf.rs
+++ b/src/libcollections/ringbuf.rs
@@ -572,7 +572,7 @@ mod tests {
     fn bench_push_back(b: &mut test::Bencher) {
         let mut deq = RingBuf::new();
         b.iter(|| {
-            deq.push_back(0);
+            deq.push_back(0i);
         })
     }
 
@@ -580,7 +580,7 @@ mod tests {
     fn bench_push_front(b: &mut test::Bencher) {
         let mut deq = RingBuf::new();
         b.iter(|| {
-            deq.push_front(0);
+            deq.push_front(0i);
         })
     }
 
@@ -589,7 +589,7 @@ mod tests {
         let mut deq = RingBuf::new();
         b.iter(|| {
             for _ in range(0i, 65) {
-                deq.push_front(1);
+                deq.push_front(1i);
             }
         })
     }
@@ -651,10 +651,10 @@ mod tests {
     #[test]
     fn test_with_capacity() {
         let mut d = RingBuf::with_capacity(0);
-        d.push_back(1);
+        d.push_back(1i);
         assert_eq!(d.len(), 1);
         let mut d = RingBuf::with_capacity(50);
-        d.push_back(1);
+        d.push_back(1i);
         assert_eq!(d.len(), 1);
     }
 
diff --git a/src/libcollections/slice.rs b/src/libcollections/slice.rs
index ac32d93edbe..40cf8495a40 100644
--- a/src/libcollections/slice.rs
+++ b/src/libcollections/slice.rs
@@ -17,7 +17,7 @@ Vectors are Rust's list type. Vectors contain zero or more values of
 homogeneous types:
 
 ```rust
-let int_vector = [1,2,3];
+let int_vector = [1i, 2i, 3i];
 let str_vector = ["one", "two", "three"];
 ```
 
@@ -41,9 +41,9 @@ An example is the method `.slice(a, b)` that returns an immutable "view" into
 a vector or a vector slice from the index interval `[a, b)`:
 
 ```rust
-let numbers = [0, 1, 2];
+let numbers = [0i, 1i, 2i];
 let last_numbers = numbers.slice(1, 3);
-// last_numbers is now &[1, 2]
+// last_numbers is now &[1i, 2i]
 ```
 
 Traits defined for the `~[T]` type, like `OwnedVector`, can only be called
@@ -54,9 +54,9 @@ An example is the method `.push(element)` that will add an element at the end
 of the vector:
 
 ```rust
-let mut numbers = vec![0, 1, 2];
+let mut numbers = vec![0i, 1i, 2i];
 numbers.push(7);
-// numbers is now vec![0, 1, 2, 7];
+// numbers is now vec![0i, 1i, 2i, 7i];
 ```
 
 ## Implementations of other traits
@@ -779,7 +779,7 @@ mod tests {
     fn test_is_empty() {
         let xs: [int, ..0] = [];
         assert!(xs.is_empty());
-        assert!(![0].is_empty());
+        assert!(![0i].is_empty());
     }
 
     #[test]
@@ -1528,7 +1528,7 @@ mod tests {
     fn test_permute_fail() {
         let v = [(box 0i, Rc::new(0i)), (box 0i, Rc::new(0i)),
                  (box 0i, Rc::new(0i)), (box 0i, Rc::new(0i))];
-        let mut i = 0;
+        let mut i = 0u;
         for _ in v.permutations() {
             if i == 2 {
                 fail!()
@@ -1870,16 +1870,16 @@ mod tests {
     fn test_overflow_does_not_cause_segfault() {
         let mut v = vec![];
         v.reserve_exact(-1);
-        v.push(1);
+        v.push(1i);
         v.push(2);
     }
 
     #[test]
     #[should_fail]
     fn test_overflow_does_not_cause_segfault_managed() {
-        let mut v = vec![Rc::new(1)];
+        let mut v = vec![Rc::new(1i)];
         v.reserve_exact(-1);
-        v.push(Rc::new(2));
+        v.push(Rc::new(2i));
     }
 
     #[test]
@@ -2279,7 +2279,7 @@ mod bench {
                 v.set_len(1024);
             }
             for x in v.mut_iter() {
-                *x = 0;
+                *x = 0i;
             }
             v
         });
diff --git a/src/libcollections/str.rs b/src/libcollections/str.rs
index 72c5aff675b..2d84c733b09 100644
--- a/src/libcollections/str.rs
+++ b/src/libcollections/str.rs
@@ -1103,7 +1103,7 @@ mod tests {
         assert_eq!("bc", unsafe {raw::slice_bytes("abc", 1, 3)});
         assert_eq!("", unsafe {raw::slice_bytes("abc", 1, 1)});
         fn a_million_letter_a() -> String {
-            let mut i = 0;
+            let mut i = 0u;
             let mut rs = String::new();
             while i < 100000 {
                 rs.push_str("aaaaaaaaaa");
@@ -1112,7 +1112,7 @@ mod tests {
             rs
         }
         fn half_a_million_letter_a() -> String {
-            let mut i = 0;
+            let mut i = 0u;
             let mut rs = String::new();
             while i < 100000 {
                 rs.push_str("aaaaa");
@@ -1220,7 +1220,7 @@ mod tests {
         assert_eq!("华", data.slice(30, 33));
 
         fn a_million_letter_x() -> String {
-            let mut i = 0;
+            let mut i = 0u;
             let mut rs = String::new();
             while i < 100000 {
                 rs.push_str("华华华华华华华华华华");
@@ -1229,7 +1229,7 @@ mod tests {
             rs
         }
         fn half_a_million_letter_x() -> String {
-            let mut i = 0;
+            let mut i = 0u;
             let mut rs = String::new();
             while i < 100000 {
                 rs.push_str("华华华华华");