diff --git a/src/libcoretest/iter.rs b/src/libcoretest/iter.rs index 8a27400389f4ada601d595879b3b0ed651c46ff4..abf88583c03ffac03f1a6a40a0c9c51a86e20060 100644 --- a/src/libcoretest/iter.rs +++ b/src/libcoretest/iter.rs @@ -12,7 +12,7 @@ use core::iter::order::*; use core::iter::MinMaxResult::*; use core::num::SignedInt; -use core::uint; +use core::usize; use core::cmp; use test::Bencher; @@ -292,7 +292,7 @@ fn count(st: &mut uint) -> Option { fn test_cycle() { let cycle_len = 3; let it = count(0, 1).take(cycle_len).cycle(); - assert_eq!(it.size_hint(), (uint::MAX, None)); + assert_eq!(it.size_hint(), (usize::MAX, None)); for (i, x) in it.take(100).enumerate() { assert_eq!(i % cycle_len, x); } @@ -365,19 +365,19 @@ fn test_iterator_size_hint() { let v2 = &[10, 11, 12]; let vi = v.iter(); - assert_eq!(c.size_hint(), (uint::MAX, None)); + assert_eq!(c.size_hint(), (usize::MAX, None)); assert_eq!(vi.clone().size_hint(), (10, Some(10))); assert_eq!(c.clone().take(5).size_hint(), (5, Some(5))); assert_eq!(c.clone().skip(5).size_hint().1, None); assert_eq!(c.clone().take_while(|_| false).size_hint(), (0, None)); assert_eq!(c.clone().skip_while(|_| false).size_hint(), (0, None)); - assert_eq!(c.clone().enumerate().size_hint(), (uint::MAX, None)); - assert_eq!(c.clone().chain(vi.clone().cloned()).size_hint(), (uint::MAX, None)); + assert_eq!(c.clone().enumerate().size_hint(), (usize::MAX, None)); + assert_eq!(c.clone().chain(vi.clone().cloned()).size_hint(), (usize::MAX, None)); assert_eq!(c.clone().zip(vi.clone()).size_hint(), (10, Some(10))); assert_eq!(c.clone().scan(0, |_,_| Some(0)).size_hint(), (0, None)); assert_eq!(c.clone().filter(|_| false).size_hint(), (0, None)); - assert_eq!(c.clone().map(|_| 0).size_hint(), (uint::MAX, None)); + assert_eq!(c.clone().map(|_| 0).size_hint(), (usize::MAX, None)); assert_eq!(c.filter_map(|_| Some(0)).size_hint(), (0, None)); assert_eq!(vi.clone().take(5).size_hint(), (5, Some(5))); @@ -753,7 +753,7 @@ fn test_range() { assert_eq!((0..100).size_hint(), (100, Some(100))); // this test is only meaningful when sizeof uint < sizeof u64 - assert_eq!((uint::MAX - 1..uint::MAX).size_hint(), (1, Some(1))); + assert_eq!((usize::MAX - 1..usize::MAX).size_hint(), (1, Some(1))); assert_eq!((-10..-1).size_hint(), (9, Some(9))); assert_eq!((-1..-10).size_hint(), (0, Some(0))); } diff --git a/src/libcoretest/num/int.rs b/src/libcoretest/num/int.rs deleted file mode 100644 index be8dfd02ee196bf25ea73f4603e49fc1e0b4ad01..0000000000000000000000000000000000000000 --- a/src/libcoretest/num/int.rs +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright 2014 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 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -int_module!(int, int); diff --git a/src/libcoretest/num/int_macros.rs b/src/libcoretest/num/int_macros.rs index f5657d939b2afccb1258032a88a37251f1809316..5ff5cf428ab1c2691340be00fcc8f18c5b31ee06 100644 --- a/src/libcoretest/num/int_macros.rs +++ b/src/libcoretest/num/int_macros.rs @@ -12,7 +12,7 @@ #[cfg(test)] mod tests { use core::$T_i::*; - use core::int; + use core::isize; use core::num::{FromStrRadix, Int, SignedInt}; use core::ops::{Shl, Shr, Not, BitXor, BitAnd, BitOr}; use num; @@ -153,7 +153,7 @@ fn test_be() { fn test_signed_checked_div() { assert!(10.checked_div(2) == Some(5)); assert!(5.checked_div(0) == None); - assert!(int::MIN.checked_div(-1) == None); + assert!(isize::MIN.checked_div(-1) == None); } #[test] diff --git a/src/libcoretest/num/mod.rs b/src/libcoretest/num/mod.rs index 03f6e51a3498a4c72f1ce88639172695add9b5cc..1cd1989c11dc3e5088cf210b06ff74965677d0e0 100644 --- a/src/libcoretest/num/mod.rs +++ b/src/libcoretest/num/mod.rs @@ -21,7 +21,6 @@ mod i16; mod i32; mod i64; -mod int; #[macro_use] mod uint_macros; @@ -30,7 +29,6 @@ mod u16; mod u32; mod u64; -mod uint; /// Helper function for testing numeric operations pub fn test_num(ten: T, two: T) where diff --git a/src/libcoretest/num/uint.rs b/src/libcoretest/num/uint.rs deleted file mode 100644 index 395e55cf255d248bce8a47b2f69ee2a132d94657..0000000000000000000000000000000000000000 --- a/src/libcoretest/num/uint.rs +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright 2014 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 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -uint_module!(uint, uint); diff --git a/src/libgetopts/lib.rs b/src/libgetopts/lib.rs index 4e329897e1ab21958e6dd520aabdaea04b3b34ff..6240b0e6afdd50861f59ced7b8a752cd8dd626b9 100644 --- a/src/libgetopts/lib.rs +++ b/src/libgetopts/lib.rs @@ -963,7 +963,7 @@ fn t(s: &str, i: uint, u: &[String]) { "little lamb".to_string(), "Little lamb".to_string() ]); - t("\nMary had a little lamb\nLittle lamb\n", ::std::uint::MAX, + t("\nMary had a little lamb\nLittle lamb\n", ::std::usize::MAX, &["Mary had a little lamb\nLittle lamb".to_string()]); } diff --git a/src/librustc/middle/liveness.rs b/src/librustc/middle/liveness.rs index 2ac019aa964dc6f1f0f15c9c4a17e917d8085a13..5cb034667cc64ad9ffa982e4f753f37f63b8edc2 100644 --- a/src/librustc/middle/liveness.rs +++ b/src/librustc/middle/liveness.rs @@ -51,8 +51,8 @@ //! enclosing function. On the way down the tree, it identifies those AST //! nodes and variable IDs that will be needed for the liveness analysis //! and assigns them contiguous IDs. The liveness id for an AST node is -//! called a `live_node` (it's a newtype'd uint) and the id for a variable -//! is called a `variable` (another newtype'd uint). +//! called a `live_node` (it's a newtype'd usize) and the id for a variable +//! is called a `variable` (another newtype'd usize). //! //! On the way back up the tree, as we are about to exit from a function //! declaration we allocate a `liveness` instance. Now that we know @@ -118,7 +118,7 @@ use lint; use util::nodemap::NodeMap; -use std::{fmt, old_io, uint}; +use std::{fmt, old_io, usize}; use std::rc::Rc; use std::iter::repeat; use syntax::ast::{self, NodeId, Expr}; @@ -138,17 +138,17 @@ enum LoopKind<'a> { } #[derive(Copy, PartialEq)] -struct Variable(uint); +struct Variable(usize); #[derive(Copy, PartialEq)] -struct LiveNode(uint); +struct LiveNode(usize); impl Variable { - fn get(&self) -> uint { let Variable(v) = *self; v } + fn get(&self) -> usize { let Variable(v) = *self; v } } impl LiveNode { - fn get(&self) -> uint { let LiveNode(v) = *self; v } + fn get(&self) -> usize { let LiveNode(v) = *self; v } } impl Clone for LiveNode { @@ -232,11 +232,11 @@ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { impl LiveNode { fn is_valid(&self) -> bool { - self.get() != uint::MAX + self.get() != usize::MAX } } -fn invalid_node() -> LiveNode { LiveNode(uint::MAX) } +fn invalid_node() -> LiveNode { LiveNode(usize::MAX) } struct CaptureInfo { ln: LiveNode, @@ -260,8 +260,8 @@ enum VarKind { struct IrMaps<'a, 'tcx: 'a> { tcx: &'a ty::ctxt<'tcx>, - num_live_nodes: uint, - num_vars: uint, + num_live_nodes: usize, + num_vars: usize, live_node_map: NodeMap, variable_map: NodeMap, capture_info_map: NodeMap>>, @@ -540,9 +540,9 @@ struct Specials { clean_exit_var: Variable } -static ACC_READ: uint = 1; -static ACC_WRITE: uint = 2; -static ACC_USE: uint = 4; +static ACC_READ: u32 = 1; +static ACC_WRITE: u32 = 2; +static ACC_USE: u32 = 4; struct Liveness<'a, 'tcx: 'a> { ir: &'a mut IrMaps<'a, 'tcx>, @@ -631,7 +631,7 @@ fn define_bindings_in_arm_pats(&mut self, pat: Option<&ast::Pat>, succ: LiveNode succ } - fn idx(&self, ln: LiveNode, var: Variable) -> uint { + fn idx(&self, ln: LiveNode, var: Variable) -> usize { ln.get() * self.ir.num_vars + var.get() } @@ -670,7 +670,7 @@ fn assigned_on_exit(&self, ln: LiveNode, var: Variable) } fn indices2(&mut self, ln: LiveNode, succ_ln: LiveNode, mut op: F) where - F: FnMut(&mut Liveness<'a, 'tcx>, uint, uint), + F: FnMut(&mut Liveness<'a, 'tcx>, usize, usize), { let node_base_idx = self.idx(ln, Variable(0)); let succ_base_idx = self.idx(succ_ln, Variable(0)); @@ -684,7 +684,7 @@ fn write_vars(&self, ln: LiveNode, mut test: F) -> old_io::IoResult<()> where - F: FnMut(uint) -> LiveNode, + F: FnMut(usize) -> LiveNode, { let node_base_idx = self.idx(ln, Variable(0)); for var_idx in 0..self.ir.num_vars { @@ -807,7 +807,7 @@ fn define(&mut self, writer: LiveNode, var: Variable) { } // Either read, write, or both depending on the acc bitset - fn acc(&mut self, ln: LiveNode, var: Variable, acc: uint) { + fn acc(&mut self, ln: LiveNode, var: Variable, acc: u32) { debug!("{:?} accesses[{:x}] {:?}: {}", ln, acc, var, self.ln_str(ln)); @@ -1283,7 +1283,7 @@ fn propagate_through_lvalue_components(&mut self, } // see comment on propagate_through_lvalue() - fn write_lvalue(&mut self, expr: &Expr, succ: LiveNode, acc: uint) + fn write_lvalue(&mut self, expr: &Expr, succ: LiveNode, acc: u32) -> LiveNode { match expr.node { ast::ExprPath(..) => { @@ -1298,7 +1298,7 @@ fn write_lvalue(&mut self, expr: &Expr, succ: LiveNode, acc: uint) } } - fn access_path(&mut self, expr: &Expr, succ: LiveNode, acc: uint) + fn access_path(&mut self, expr: &Expr, succ: LiveNode, acc: u32) -> LiveNode { match self.ir.tcx.def_map.borrow()[expr.id].full_def() { DefLocal(nid) => { diff --git a/src/librustc_trans/trans/_match.rs b/src/librustc_trans/trans/_match.rs index 48ff4c8332022aac0972c153eade715fbbe7be42..2ab6f5b0f952178b3637b9998fdb3d290b207c55 100644 --- a/src/librustc_trans/trans/_match.rs +++ b/src/librustc_trans/trans/_match.rs @@ -789,7 +789,7 @@ fn pat_score(def_map: &DefMap, pat: &ast::Pat) -> uint { // Irrefutable columns always go first, they'd only be duplicated in the branches. if total_score == 0 { - std::uint::MAX + std::usize::MAX } else { total_score } diff --git a/src/libstd/lib.rs b/src/libstd/lib.rs index 607c124076d192a39e753c623f30ac42fa437c55..7957bc35b76b5c3e90507df79c6b624e9b2c6326 100644 --- a/src/libstd/lib.rs +++ b/src/libstd/lib.rs @@ -221,14 +221,12 @@ mod uint_macros; #[path = "num/isize.rs"] pub mod isize; -pub use isize as int; #[path = "num/i8.rs"] pub mod i8; #[path = "num/i16.rs"] pub mod i16; #[path = "num/i32.rs"] pub mod i32; #[path = "num/i64.rs"] pub mod i64; #[path = "num/usize.rs"] pub mod usize; -pub use usize as uint; #[path = "num/u8.rs"] pub mod u8; #[path = "num/u16.rs"] pub mod u16; #[path = "num/u32.rs"] pub mod u32; diff --git a/src/test/compile-fail/issue-8460-const.rs b/src/test/compile-fail/issue-8460-const.rs index 954ae8ebc48dd87df4dff656dee302492a309e1c..9c2e8d278ab0b8310db1190bd21c2ee27c824730 100644 --- a/src/test/compile-fail/issue-8460-const.rs +++ b/src/test/compile-fail/issue-8460-const.rs @@ -8,11 +8,11 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use std::{int, i8, i16, i32, i64}; +use std::{isize, i8, i16, i32, i64}; use std::thread; fn main() { - assert!(thread::spawn(move|| { int::MIN / -1; }).join().is_err()); + assert!(thread::spawn(move|| { isize::MIN / -1; }).join().is_err()); //~^ ERROR attempted to divide with overflow in a constant expression assert!(thread::spawn(move|| { i8::MIN / -1; }).join().is_err()); //~^ ERROR attempted to divide with overflow in a constant expression @@ -32,7 +32,7 @@ fn main() { //~^ ERROR attempted to divide by zero in a constant expression assert!(thread::spawn(move|| { 1i64 / 0; }).join().is_err()); //~^ ERROR attempted to divide by zero in a constant expression - assert!(thread::spawn(move|| { int::MIN % -1; }).join().is_err()); + assert!(thread::spawn(move|| { isize::MIN % -1; }).join().is_err()); //~^ ERROR attempted remainder with overflow in a constant expression assert!(thread::spawn(move|| { i8::MIN % -1; }).join().is_err()); //~^ ERROR attempted remainder with overflow in a constant expression diff --git a/src/test/compile-fail/unnecessary-private.rs b/src/test/compile-fail/unnecessary-private.rs index 964db6e9a4546bfb8b8ad18cfd80dc5af26110eb..5f3744712ccb4c2b5b2049b70533ec4bdfe8e9c7 100644 --- a/src/test/compile-fail/unnecessary-private.rs +++ b/src/test/compile-fail/unnecessary-private.rs @@ -9,7 +9,7 @@ // except according to those terms. fn main() { - pub use std::uint; //~ ERROR: visibility has no effect + pub use std::usize; //~ ERROR: visibility has no effect pub struct A; //~ ERROR: visibility has no effect pub enum B {} //~ ERROR: visibility has no effect pub trait C { //~ ERROR: visibility has no effect diff --git a/src/test/run-fail/bounds-check-no-overflow.rs b/src/test/run-fail/bounds-check-no-overflow.rs index be4ad0781f272f9ee40110772d5b1b79000ca3e9..c15c4b83828a34bff88dde7f2c43eea5a36535b8 100644 --- a/src/test/run-fail/bounds-check-no-overflow.rs +++ b/src/test/run-fail/bounds-check-no-overflow.rs @@ -10,10 +10,10 @@ // error-pattern:index out of bounds: the len is 3 but the index is -use std::uint; +use std::usize; use std::mem::size_of; fn main() { let xs = [1, 2, 3]; - xs[uint::MAX / size_of::() + 1]; + xs[usize::MAX / size_of::() + 1]; } diff --git a/src/test/run-fail/hashmap-capacity-overflow.rs b/src/test/run-fail/hashmap-capacity-overflow.rs index c86f8a38f63c409f32eeb4885a17da54050f398e..2c7c0875227d9baeddb83028f6bf45cf2c6290d8 100644 --- a/src/test/run-fail/hashmap-capacity-overflow.rs +++ b/src/test/run-fail/hashmap-capacity-overflow.rs @@ -11,11 +11,11 @@ // error-pattern:capacity overflow use std::collections::hash_map::HashMap; -use std::uint; +use std::usize; use std::mem::size_of; fn main() { - let threshold = uint::MAX / size_of::<(u64, u64, u64)>(); + let threshold = usize::MAX / size_of::<(u64, u64, u64)>(); let mut h = HashMap::::with_capacity(threshold + 100); h.insert(0, 0); }