diff --git a/src/libcore/lib.rs b/src/libcore/lib.rs index a9d6997359085..7cc963bed358f 100644 --- a/src/libcore/lib.rs +++ b/src/libcore/lib.rs @@ -39,7 +39,7 @@ //! distribution. //! //! * `rust_begin_unwind` - This function takes three arguments, a -//! `fmt::Arguments`, a `&str`, and a `uint`. These three arguments dictate +//! `fmt::Arguments`, a `&str`, and a `usize`. These three arguments dictate //! the panic message, the file at which panic was invoked, and the line. //! It is up to consumers of this core library to define this panic //! function; it is only required to never return. @@ -88,14 +88,12 @@ mod int_macros; #[macro_use] mod uint_macros; -#[path = "num/int.rs"] pub mod int; #[path = "num/isize.rs"] pub mod isize; #[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/uint.rs"] pub mod uint; #[path = "num/usize.rs"] pub mod usize; #[path = "num/u8.rs"] pub mod u8; #[path = "num/u16.rs"] pub mod u16; diff --git a/src/libcore/num/int.rs b/src/libcore/num/int.rs deleted file mode 100644 index 2132b9516abad..0000000000000 --- a/src/libcore/num/int.rs +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright 2012-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. - -//! Deprecated: replaced by `isize`. -//! -//! The rollout of the new type will gradually take place over the -//! alpha cycle along with the development of clearer conventions -//! around integer types. - -#![unstable(feature = "core")] -#![deprecated(since = "1.0.0", reason = "replaced by isize")] - -#[cfg(target_pointer_width = "32")] int_module! { int, 32 } -#[cfg(target_pointer_width = "64")] int_module! { int, 64 } diff --git a/src/libcore/num/uint.rs b/src/libcore/num/uint.rs deleted file mode 100644 index f66a0eed97161..0000000000000 --- a/src/libcore/num/uint.rs +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2012-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. - -//! Deprecated: replaced by `usize`. -//! -//! The rollout of the new type will gradually take place over the -//! alpha cycle along with the development of clearer conventions -//! around integer types. - -#![unstable(feature = "core")] -#![deprecated(since = "1.0.0", reason = "replaced by usize")] - -uint_module! { uint, int, ::int::BITS } diff --git a/src/libcoretest/iter.rs b/src/libcoretest/iter.rs index 8a27400389f4a..abf88583c03ff 100644 --- a/src/libcoretest/iter.rs +++ b/src/libcoretest/iter.rs @@ -12,7 +12,7 @@ use core::iter::*; 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 test_unfoldr() { 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 be8dfd02ee196..0000000000000 --- 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 f5657d939b2af..5ff5cf428ab1c 100644 --- a/src/libcoretest/num/int_macros.rs +++ b/src/libcoretest/num/int_macros.rs @@ -12,7 +12,7 @@ macro_rules! int_module { ($T:ty, $T_i:ident) => ( #[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 @@ mod tests { 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 03f6e51a3498a..1cd1989c11dc3 100644 --- a/src/libcoretest/num/mod.rs +++ b/src/libcoretest/num/mod.rs @@ -21,7 +21,6 @@ mod i8; mod i16; mod i32; mod i64; -mod int; #[macro_use] mod uint_macros; @@ -30,7 +29,6 @@ mod u8; 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 395e55cf255d2..0000000000000 --- 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 4e329897e1ab2..6240b0e6afdd5 100644 --- a/src/libgetopts/lib.rs +++ b/src/libgetopts/lib.rs @@ -963,7 +963,7 @@ fn test_split_within() { "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/librand/rand_impls.rs b/src/librand/rand_impls.rs index d5c5d5004657e..74d2c408060cb 100644 --- a/src/librand/rand_impls.rs +++ b/src/librand/rand_impls.rs @@ -12,18 +12,18 @@ use core::prelude::*; use core::char; -use core::int; -use core::uint; +use core::isize; +use core::usize; use {Rand,Rng}; -impl Rand for int { +impl Rand for isize { #[inline] - fn rand(rng: &mut R) -> int { - if int::BITS == 32 { - rng.gen::() as int + fn rand(rng: &mut R) -> isize { + if isize::BITS == 32 { + rng.gen::() as isize } else { - rng.gen::() as int + rng.gen::() as isize } } } @@ -56,13 +56,13 @@ impl Rand for i64 { } } -impl Rand for uint { +impl Rand for usize { #[inline] - fn rand(rng: &mut R) -> uint { - if uint::BITS == 32 { - rng.gen::() as uint + fn rand(rng: &mut R) -> usize { + if usize::BITS == 32 { + rng.gen::() as usize } else { - rng.gen::() as uint + rng.gen::() as usize } } } diff --git a/src/librustc/middle/liveness.rs b/src/librustc/middle/liveness.rs index 2ac019aa964dc..5cb034667cc64 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 middle::ty::ClosureTyper; 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 @@ impl fmt::Debug for Variable { 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 @@ impl<'a, 'tcx> Liveness<'a, 'tcx> { 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 @@ impl<'a, 'tcx> Liveness<'a, 'tcx> { } 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 @@ impl<'a, 'tcx> Liveness<'a, 'tcx> { 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 @@ impl<'a, 'tcx> Liveness<'a, 'tcx> { } // 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 @@ impl<'a, 'tcx> Liveness<'a, 'tcx> { } // 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 @@ impl<'a, 'tcx> Liveness<'a, 'tcx> { } } - 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 48ff4c8332022..2ab6f5b0f9521 100644 --- a/src/librustc_trans/trans/_match.rs +++ b/src/librustc_trans/trans/_match.rs @@ -789,7 +789,7 @@ fn pick_column_to_specialize(def_map: &DefMap, m: &[Match]) -> Option { // 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 b5bdeb7f181b0..7957bc35b76b5 100644 --- a/src/libstd/lib.rs +++ b/src/libstd/lib.rs @@ -109,7 +109,7 @@ #![feature(box_syntax)] #![feature(collections)] #![feature(core)] -#![feature(int_uint)] +#![feature(hash)] #![feature(lang_items)] #![feature(libc)] #![feature(linkage, thread_local, asm)] @@ -221,14 +221,12 @@ mod int_macros; 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 954ae8ebc48dd..9c2e8d278ab0b 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 964db6e9a4546..5f3744712ccb4 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 be4ad0781f272..c15c4b83828a3 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 c86f8a38f63c4..2c7c0875227d9 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); }