about summary refs log tree commit diff
path: root/src/libcore
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/libcore
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/libcore')
-rw-r--r--src/libcore/cell.rs26
-rw-r--r--src/libcore/cmp.rs6
-rw-r--r--src/libcore/fmt/mod.rs2
-rw-r--r--src/libcore/fmt/num.rs2
-rw-r--r--src/libcore/iter.rs10
-rw-r--r--src/libcore/mem.rs10
-rw-r--r--src/libcore/option.rs4
7 files changed, 30 insertions, 30 deletions
diff --git a/src/libcore/cell.rs b/src/libcore/cell.rs
index ab701b76026..8cd65c4f564 100644
--- a/src/libcore/cell.rs
+++ b/src/libcore/cell.rs
@@ -67,10 +67,10 @@
 //!
 //! fn main() {
 //!     let shared_map: Rc<RefCell<_>> = Rc::new(RefCell::new(HashMap::new()));
-//!     shared_map.borrow_mut().insert("africa", 92388);
-//!     shared_map.borrow_mut().insert("kyoto", 11837);
-//!     shared_map.borrow_mut().insert("piccadilly", 11826);
-//!     shared_map.borrow_mut().insert("marbles", 38);
+//!     shared_map.borrow_mut().insert("africa", 92388i);
+//!     shared_map.borrow_mut().insert("kyoto", 11837i);
+//!     shared_map.borrow_mut().insert("piccadilly", 11826i);
+//!     shared_map.borrow_mut().insert("marbles", 38i);
 //! }
 //! ```
 //!
@@ -433,35 +433,35 @@ mod test {
 
     #[test]
     fn double_imm_borrow() {
-        let x = RefCell::new(0);
+        let x = RefCell::new(0i);
         let _b1 = x.borrow();
         x.borrow();
     }
 
     #[test]
     fn no_mut_then_imm_borrow() {
-        let x = RefCell::new(0);
+        let x = RefCell::new(0i);
         let _b1 = x.borrow_mut();
         assert!(x.try_borrow().is_none());
     }
 
     #[test]
     fn no_imm_then_borrow_mut() {
-        let x = RefCell::new(0);
+        let x = RefCell::new(0i);
         let _b1 = x.borrow();
         assert!(x.try_borrow_mut().is_none());
     }
 
     #[test]
     fn no_double_borrow_mut() {
-        let x = RefCell::new(0);
+        let x = RefCell::new(0i);
         let _b1 = x.borrow_mut();
         assert!(x.try_borrow_mut().is_none());
     }
 
     #[test]
     fn imm_release_borrow_mut() {
-        let x = RefCell::new(0);
+        let x = RefCell::new(0i);
         {
             let _b1 = x.borrow();
         }
@@ -470,7 +470,7 @@ mod test {
 
     #[test]
     fn mut_release_borrow_mut() {
-        let x = RefCell::new(0);
+        let x = RefCell::new(0i);
         {
             let _b1 = x.borrow_mut();
         }
@@ -479,7 +479,7 @@ mod test {
 
     #[test]
     fn double_borrow_single_release_no_borrow_mut() {
-        let x = RefCell::new(0);
+        let x = RefCell::new(0i);
         let _b1 = x.borrow();
         {
             let _b2 = x.borrow();
@@ -490,7 +490,7 @@ mod test {
     #[test]
     #[should_fail]
     fn discard_doesnt_unborrow() {
-        let x = RefCell::new(0);
+        let x = RefCell::new(0i);
         let _b = x.borrow();
         let _ = _b;
         let _b = x.borrow_mut();
@@ -499,7 +499,7 @@ mod test {
     #[test]
     #[allow(experimental)]
     fn clone_ref_updates_flag() {
-        let x = RefCell::new(0);
+        let x = RefCell::new(0i);
         {
             let b1 = x.borrow();
             assert!(x.try_borrow_mut().is_none());
diff --git a/src/libcore/cmp.rs b/src/libcore/cmp.rs
index d7a3edccfd8..197997507a6 100644
--- a/src/libcore/cmp.rs
+++ b/src/libcore/cmp.rs
@@ -86,11 +86,11 @@ pub trait Eq: PartialEq {
 #[deriving(Clone, PartialEq, Show)]
 pub enum Ordering {
    /// An ordering where a compared value is less [than another].
-   Less = -1,
+   Less = -1i,
    /// An ordering where a compared value is equal [to another].
-   Equal = 0,
+   Equal = 0i,
    /// An ordering where a compared value is greater [than another].
-   Greater = 1
+   Greater = 1i,
 }
 
 /// Trait for types that form a [total order](
diff --git a/src/libcore/fmt/mod.rs b/src/libcore/fmt/mod.rs
index 1a66d952e9b..1096758a22d 100644
--- a/src/libcore/fmt/mod.rs
+++ b/src/libcore/fmt/mod.rs
@@ -686,7 +686,7 @@ macro_rules! tuple (
             fn fmt(&self, f: &mut Formatter) -> Result {
                 try!(write!(f, "("));
                 let ($(ref $name,)*) = *self;
-                let mut n = 0;
+                let mut n = 0i;
                 $(
                     if n > 0 {
                         try!(write!(f, ", "));
diff --git a/src/libcore/fmt/num.rs b/src/libcore/fmt/num.rs
index 56d0817dd00..d3edfd42feb 100644
--- a/src/libcore/fmt/num.rs
+++ b/src/libcore/fmt/num.rs
@@ -388,7 +388,7 @@ mod tests {
     #[test]
     #[should_fail]
     fn test_radix_base_too_large() {
-        let _ = radix(55, 37);
+        let _ = radix(55i, 37);
     }
 }
 
diff --git a/src/libcore/iter.rs b/src/libcore/iter.rs
index ec53ef93dc1..c041ef5706b 100644
--- a/src/libcore/iter.rs
+++ b/src/libcore/iter.rs
@@ -2649,10 +2649,10 @@ mod tests {
         assert_eq!(c.enumerate().size_hint(), (uint::MAX, None));
         assert_eq!(c.chain(vi.map(|&i| i)).size_hint(), (uint::MAX, None));
         assert_eq!(c.zip(vi).size_hint(), (10, Some(10)));
-        assert_eq!(c.scan(0, |_,_| Some(0)).size_hint(), (0, None));
+        assert_eq!(c.scan(0i, |_,_| Some(0i)).size_hint(), (0, None));
         assert_eq!(c.filter(|_| false).size_hint(), (0, None));
-        assert_eq!(c.map(|_| 0).size_hint(), (uint::MAX, None));
-        assert_eq!(c.filter_map(|_| Some(0)).size_hint(), (0, None));
+        assert_eq!(c.map(|_| 0i).size_hint(), (uint::MAX, None));
+        assert_eq!(c.filter_map(|_| Some(0i)).size_hint(), (0, None));
 
         assert_eq!(vi.take(5).size_hint(), (5, Some(5)));
         assert_eq!(vi.take(12).size_hint(), (10, Some(10)));
@@ -2663,10 +2663,10 @@ mod tests {
         assert_eq!(vi.enumerate().size_hint(), (10, Some(10)));
         assert_eq!(vi.chain(v2.iter()).size_hint(), (13, Some(13)));
         assert_eq!(vi.zip(v2.iter()).size_hint(), (3, Some(3)));
-        assert_eq!(vi.scan(0, |_,_| Some(0)).size_hint(), (0, Some(10)));
+        assert_eq!(vi.scan(0i, |_,_| Some(0i)).size_hint(), (0, Some(10)));
         assert_eq!(vi.filter(|_| false).size_hint(), (0, Some(10)));
         assert_eq!(vi.map(|i| i+1).size_hint(), (10, Some(10)));
-        assert_eq!(vi.filter_map(|_| Some(0)).size_hint(), (0, Some(10)));
+        assert_eq!(vi.filter_map(|_| Some(0i)).size_hint(), (0, Some(10)));
     }
 
     #[test]
diff --git a/src/libcore/mem.rs b/src/libcore/mem.rs
index d1e2084243d..39ec830179c 100644
--- a/src/libcore/mem.rs
+++ b/src/libcore/mem.rs
@@ -475,7 +475,7 @@ mod tests {
 
     #[test]
     fn test_transmute_copy() {
-        assert_eq!(1u, unsafe { ::mem::transmute_copy(&1) });
+        assert_eq!(1u, unsafe { ::mem::transmute_copy(&1i) });
     }
 
     #[test]
@@ -541,7 +541,7 @@ mod bench {
 
     #[bench]
     fn match_option_some(b: &mut Bencher) {
-        let x = Some(10);
+        let x = Some(10i);
         b.iter(|| {
             match x {
                 Some(y) => y,
@@ -552,11 +552,11 @@ mod bench {
 
     #[bench]
     fn match_vec_pattern(b: &mut Bencher) {
-        let x = [1,2,3,4,5,6];
+        let x = [1i,2,3,4,5,6];
         b.iter(|| {
             match x {
-                [1,2,3,..] => 10,
-                _ => 11
+                [1,2,3,..] => 10i,
+                _ => 11i,
             }
         });
     }
diff --git a/src/libcore/option.rs b/src/libcore/option.rs
index 9748235e94a..949e6a5b9a0 100644
--- a/src/libcore/option.rs
+++ b/src/libcore/option.rs
@@ -627,7 +627,7 @@ mod tests {
     #[test]
     fn test_get_ptr() {
         unsafe {
-            let x = box 0;
+            let x = box 0i;
             let addr_x: *const int = ::mem::transmute(&*x);
             let opt = Some(x);
             let y = opt.unwrap();
@@ -750,7 +750,7 @@ mod tests {
     #[test]
     fn test_option_while_some() {
         let mut i = 0i;
-        Some(10).while_some(|j| {
+        Some(10i).while_some(|j| {
             i += 1;
             if j > 0 {
                 Some(j-1)