diff options
| author | Alex Crichton <alex@alexcrichton.com> | 2015-03-25 17:06:52 -0700 |
|---|---|---|
| committer | Alex Crichton <alex@alexcrichton.com> | 2015-03-26 12:10:22 -0700 |
| commit | 43bfaa4a336095eb5697fb2df50909fd3c72ed14 (patch) | |
| tree | e10610e1ce9811c89e1291b786d7a49b63ee02d9 /src/libcore | |
| parent | 54f16b818b58f6d6e81891b041fc751986e75155 (diff) | |
| download | rust-43bfaa4a336095eb5697fb2df50909fd3c72ed14.tar.gz rust-43bfaa4a336095eb5697fb2df50909fd3c72ed14.zip | |
Mass rename uint/int to usize/isize
Now that support has been removed, all lingering use cases are renamed.
Diffstat (limited to 'src/libcore')
| -rw-r--r-- | src/libcore/atomic.rs | 44 | ||||
| -rw-r--r-- | src/libcore/fmt/float.rs | 4 | ||||
| -rw-r--r-- | src/libcore/intrinsics.rs | 2 | ||||
| -rw-r--r-- | src/libcore/lib.rs | 1 | ||||
| -rw-r--r-- | src/libcore/macros.rs | 2 | ||||
| -rw-r--r-- | src/libcore/num/f32.rs | 12 | ||||
| -rw-r--r-- | src/libcore/num/f64.rs | 12 | ||||
| -rw-r--r-- | src/libcore/num/mod.rs | 100 | ||||
| -rw-r--r-- | src/libcore/num/wrapping.rs | 10 | ||||
| -rw-r--r-- | src/libcore/panicking.rs | 6 | ||||
| -rw-r--r-- | src/libcore/result.rs | 38 | ||||
| -rw-r--r-- | src/libcore/str/mod.rs | 2 |
12 files changed, 117 insertions, 116 deletions
diff --git a/src/libcore/atomic.rs b/src/libcore/atomic.rs index c316236a804..4bbbfbaace9 100644 --- a/src/libcore/atomic.rs +++ b/src/libcore/atomic.rs @@ -1064,7 +1064,7 @@ pub fn fence(order: Ordering) { reason = "renamed to AtomicIsize")] #[allow(missing_docs)] pub struct AtomicInt { - v: UnsafeCell<int>, + v: UnsafeCell<isize>, } #[allow(deprecated)] @@ -1075,7 +1075,7 @@ unsafe impl Sync for AtomicInt {} reason = "renamed to AtomicUsize")] #[allow(missing_docs)] pub struct AtomicUint { - v: UnsafeCell<uint>, + v: UnsafeCell<usize>, } #[allow(deprecated)] @@ -1097,52 +1097,52 @@ pub const ATOMIC_UINT_INIT: AtomicUint = #[allow(missing_docs, deprecated)] impl AtomicInt { #[inline] - pub fn new(v: int) -> AtomicInt { + pub fn new(v: isize) -> AtomicInt { AtomicInt {v: UnsafeCell::new(v)} } #[inline] - pub fn load(&self, order: Ordering) -> int { + pub fn load(&self, order: Ordering) -> isize { unsafe { atomic_load(self.v.get(), order) } } #[inline] - pub fn store(&self, val: int, order: Ordering) { + pub fn store(&self, val: isize, order: Ordering) { unsafe { atomic_store(self.v.get(), val, order); } } #[inline] - pub fn swap(&self, val: int, order: Ordering) -> int { + pub fn swap(&self, val: isize, order: Ordering) -> isize { unsafe { atomic_swap(self.v.get(), val, order) } } #[inline] - pub fn compare_and_swap(&self, old: int, new: int, order: Ordering) -> int { + pub fn compare_and_swap(&self, old: isize, new: isize, order: Ordering) -> isize { unsafe { atomic_compare_and_swap(self.v.get(), old, new, order) } } #[inline] - pub fn fetch_add(&self, val: int, order: Ordering) -> int { + pub fn fetch_add(&self, val: isize, order: Ordering) -> isize { unsafe { atomic_add(self.v.get(), val, order) } } #[inline] - pub fn fetch_sub(&self, val: int, order: Ordering) -> int { + pub fn fetch_sub(&self, val: isize, order: Ordering) -> isize { unsafe { atomic_sub(self.v.get(), val, order) } } #[inline] - pub fn fetch_and(&self, val: int, order: Ordering) -> int { + pub fn fetch_and(&self, val: isize, order: Ordering) -> isize { unsafe { atomic_and(self.v.get(), val, order) } } #[inline] - pub fn fetch_or(&self, val: int, order: Ordering) -> int { + pub fn fetch_or(&self, val: isize, order: Ordering) -> isize { unsafe { atomic_or(self.v.get(), val, order) } } #[inline] - pub fn fetch_xor(&self, val: int, order: Ordering) -> int { + pub fn fetch_xor(&self, val: isize, order: Ordering) -> isize { unsafe { atomic_xor(self.v.get(), val, order) } } } @@ -1150,52 +1150,52 @@ impl AtomicInt { #[allow(missing_docs, deprecated)] impl AtomicUint { #[inline] - pub fn new(v: uint) -> AtomicUint { + pub fn new(v: usize) -> AtomicUint { AtomicUint { v: UnsafeCell::new(v) } } #[inline] - pub fn load(&self, order: Ordering) -> uint { + pub fn load(&self, order: Ordering) -> usize { unsafe { atomic_load(self.v.get(), order) } } #[inline] - pub fn store(&self, val: uint, order: Ordering) { + pub fn store(&self, val: usize, order: Ordering) { unsafe { atomic_store(self.v.get(), val, order); } } #[inline] - pub fn swap(&self, val: uint, order: Ordering) -> uint { + pub fn swap(&self, val: usize, order: Ordering) -> usize { unsafe { atomic_swap(self.v.get(), val, order) } } #[inline] - pub fn compare_and_swap(&self, old: uint, new: uint, order: Ordering) -> uint { + pub fn compare_and_swap(&self, old: usize, new: usize, order: Ordering) -> usize { unsafe { atomic_compare_and_swap(self.v.get(), old, new, order) } } #[inline] - pub fn fetch_add(&self, val: uint, order: Ordering) -> uint { + pub fn fetch_add(&self, val: usize, order: Ordering) -> usize { unsafe { atomic_add(self.v.get(), val, order) } } #[inline] - pub fn fetch_sub(&self, val: uint, order: Ordering) -> uint { + pub fn fetch_sub(&self, val: usize, order: Ordering) -> usize { unsafe { atomic_sub(self.v.get(), val, order) } } #[inline] - pub fn fetch_and(&self, val: uint, order: Ordering) -> uint { + pub fn fetch_and(&self, val: usize, order: Ordering) -> usize { unsafe { atomic_and(self.v.get(), val, order) } } #[inline] - pub fn fetch_or(&self, val: uint, order: Ordering) -> uint { + pub fn fetch_or(&self, val: usize, order: Ordering) -> usize { unsafe { atomic_or(self.v.get(), val, order) } } #[inline] - pub fn fetch_xor(&self, val: uint, order: Ordering) -> uint { + pub fn fetch_xor(&self, val: usize, order: Ordering) -> usize { unsafe { atomic_xor(self.v.get(), val, order) } } } diff --git a/src/libcore/fmt/float.rs b/src/libcore/fmt/float.rs index 0df04c296c8..ee2951602c7 100644 --- a/src/libcore/fmt/float.rs +++ b/src/libcore/fmt/float.rs @@ -125,7 +125,7 @@ pub fn float_to_str_bytes_common<T: Float, U, F>( // otherwise as well. let mut buf = [0; 1536]; let mut end = 0; - let radix_gen: T = cast(radix as int).unwrap(); + let radix_gen: T = cast(radix as isize).unwrap(); let (num, exp) = match exp_format { ExpNone => (num, 0), @@ -235,7 +235,7 @@ pub fn float_to_str_bytes_common<T: Float, U, F>( let extra_digit = ascii2value(buf[end - 1]); end -= 1; if extra_digit >= radix / 2 { // -> need to round - let mut i: int = end as int - 1; + let mut i: isize = end as isize - 1; loop { // If reached left end of number, have to // insert additional digit: diff --git a/src/libcore/intrinsics.rs b/src/libcore/intrinsics.rs index 1f1044b0b21..e2e5d26d6f7 100644 --- a/src/libcore/intrinsics.rs +++ b/src/libcore/intrinsics.rs @@ -315,7 +315,7 @@ extern "rust-intrinsic" { /// # #![feature(core)] /// use std::ptr; /// - /// unsafe fn from_buf_raw<T>(ptr: *const T, elts: uint) -> Vec<T> { + /// unsafe fn from_buf_raw<T>(ptr: *const T, elts: usize) -> Vec<T> { /// let mut dst = Vec::with_capacity(elts); /// dst.set_len(elts); /// ptr::copy(dst.as_mut_ptr(), ptr, elts); diff --git a/src/libcore/lib.rs b/src/libcore/lib.rs index a2b13584270..dc1aef034eb 100644 --- a/src/libcore/lib.rs +++ b/src/libcore/lib.rs @@ -63,7 +63,6 @@ #![allow(raw_pointer_derive)] #![deny(missing_docs)] -#![feature(int_uint)] #![feature(intrinsics, lang_items)] #![feature(on_unimplemented)] #![feature(simd, unsafe_destructor)] diff --git a/src/libcore/macros.rs b/src/libcore/macros.rs index 40e32f4171a..d5a7c1d6b26 100644 --- a/src/libcore/macros.rs +++ b/src/libcore/macros.rs @@ -218,7 +218,7 @@ macro_rules! writeln { /// Match arms: /// /// ``` -/// fn foo(x: Option<int>) { +/// fn foo(x: Option<i32>) { /// match x { /// Some(n) if n >= 0 => println!("Some(Non-negative)"), /// Some(n) if n < 0 => println!("Some(Negative)"), diff --git a/src/libcore/num/f32.rs b/src/libcore/num/f32.rs index d211b0f9928..5b660970b86 100644 --- a/src/libcore/num/f32.rs +++ b/src/libcore/num/f32.rs @@ -193,12 +193,12 @@ impl Float for f32 { #[inline] #[unstable(feature = "core")] #[deprecated(since = "1.0.0")] - fn mantissa_digits(_: Option<f32>) -> uint { MANTISSA_DIGITS as uint } + fn mantissa_digits(_: Option<f32>) -> usize { MANTISSA_DIGITS as usize } #[inline] #[unstable(feature = "core")] #[deprecated(since = "1.0.0")] - fn digits(_: Option<f32>) -> uint { DIGITS as uint } + fn digits(_: Option<f32>) -> usize { DIGITS as usize } #[inline] #[unstable(feature = "core")] @@ -208,22 +208,22 @@ impl Float for f32 { #[inline] #[unstable(feature = "core")] #[deprecated(since = "1.0.0")] - fn min_exp(_: Option<f32>) -> int { MIN_EXP as int } + fn min_exp(_: Option<f32>) -> isize { MIN_EXP as isize } #[inline] #[unstable(feature = "core")] #[deprecated(since = "1.0.0")] - fn max_exp(_: Option<f32>) -> int { MAX_EXP as int } + fn max_exp(_: Option<f32>) -> isize { MAX_EXP as isize } #[inline] #[unstable(feature = "core")] #[deprecated(since = "1.0.0")] - fn min_10_exp(_: Option<f32>) -> int { MIN_10_EXP as int } + fn min_10_exp(_: Option<f32>) -> isize { MIN_10_EXP as isize } #[inline] #[unstable(feature = "core")] #[deprecated(since = "1.0.0")] - fn max_10_exp(_: Option<f32>) -> int { MAX_10_EXP as int } + fn max_10_exp(_: Option<f32>) -> isize { MAX_10_EXP as isize } #[inline] #[unstable(feature = "core")] diff --git a/src/libcore/num/f64.rs b/src/libcore/num/f64.rs index 1421fdd72f2..729b9422d5c 100644 --- a/src/libcore/num/f64.rs +++ b/src/libcore/num/f64.rs @@ -200,12 +200,12 @@ impl Float for f64 { #[inline] #[unstable(feature = "core")] #[deprecated(since = "1.0.0")] - fn mantissa_digits(_: Option<f64>) -> uint { MANTISSA_DIGITS as uint } + fn mantissa_digits(_: Option<f64>) -> usize { MANTISSA_DIGITS as usize } #[inline] #[unstable(feature = "core")] #[deprecated(since = "1.0.0")] - fn digits(_: Option<f64>) -> uint { DIGITS as uint } + fn digits(_: Option<f64>) -> usize { DIGITS as usize } #[inline] #[unstable(feature = "core")] @@ -215,22 +215,22 @@ impl Float for f64 { #[inline] #[unstable(feature = "core")] #[deprecated(since = "1.0.0")] - fn min_exp(_: Option<f64>) -> int { MIN_EXP as int } + fn min_exp(_: Option<f64>) -> isize { MIN_EXP as isize } #[inline] #[unstable(feature = "core")] #[deprecated(since = "1.0.0")] - fn max_exp(_: Option<f64>) -> int { MAX_EXP as int } + fn max_exp(_: Option<f64>) -> isize { MAX_EXP as isize } #[inline] #[unstable(feature = "core")] #[deprecated(since = "1.0.0")] - fn min_10_exp(_: Option<f64>) -> int { MIN_10_EXP as int } + fn min_10_exp(_: Option<f64>) -> isize { MIN_10_EXP as isize } #[inline] #[unstable(feature = "core")] #[deprecated(since = "1.0.0")] - fn max_10_exp(_: Option<f64>) -> int { MAX_10_EXP as int } + fn max_10_exp(_: Option<f64>) -> isize { MAX_10_EXP as isize } #[inline] #[unstable(feature = "core")] diff --git a/src/libcore/num/mod.rs b/src/libcore/num/mod.rs index 0eec875afc3..38f067ccb8c 100644 --- a/src/libcore/num/mod.rs +++ b/src/libcore/num/mod.rs @@ -52,8 +52,8 @@ pub trait Int + BitAnd<Output=Self> + BitOr<Output=Self> + BitXor<Output=Self> - + Shl<uint, Output=Self> - + Shr<uint, Output=Self> + + Shl<usize, Output=Self> + + Shr<usize, Output=Self> + WrappingOps + OverflowingOps { @@ -565,7 +565,7 @@ uint_impl! { u64 = u64, 64, intrinsics::u64_mul_with_overflow } #[cfg(target_pointer_width = "32")] -uint_impl! { uint = u32, 32, +uint_impl! { usize = u32, 32, intrinsics::ctpop32, intrinsics::ctlz32, intrinsics::cttz32, @@ -575,7 +575,7 @@ uint_impl! { uint = u32, 32, intrinsics::u32_mul_with_overflow } #[cfg(target_pointer_width = "64")] -uint_impl! { uint = u64, 64, +uint_impl! { usize = u64, 64, intrinsics::ctpop64, intrinsics::ctlz64, intrinsics::cttz64, @@ -680,13 +680,13 @@ int_impl! { i64 = i64, u64, 64, intrinsics::i64_mul_with_overflow } #[cfg(target_pointer_width = "32")] -int_impl! { int = i32, u32, 32, +int_impl! { isize = i32, u32, 32, intrinsics::i32_add_with_overflow, intrinsics::i32_sub_with_overflow, intrinsics::i32_mul_with_overflow } #[cfg(target_pointer_width = "64")] -int_impl! { int = i64, u64, 64, +int_impl! { isize = i64, u64, 64, intrinsics::i64_add_with_overflow, intrinsics::i64_sub_with_overflow, intrinsics::i64_mul_with_overflow } @@ -752,7 +752,7 @@ signed_int_impl! { i8 } signed_int_impl! { i16 } signed_int_impl! { i32 } signed_int_impl! { i64 } -signed_int_impl! { int } +signed_int_impl! { isize } // `Int` + `SignedInt` implemented for signed integers macro_rules! int_impl { @@ -1232,7 +1232,7 @@ impl i64 { #[cfg(target_pointer_width = "32")] #[lang = "isize"] impl isize { - int_impl! { int = i32, u32, 32, + int_impl! { isize = i32, u32, 32, intrinsics::i32_add_with_overflow, intrinsics::i32_sub_with_overflow, intrinsics::i32_mul_with_overflow } @@ -1241,7 +1241,7 @@ impl isize { #[cfg(target_pointer_width = "64")] #[lang = "isize"] impl isize { - int_impl! { int = i64, u64, 64, + int_impl! { isize = i64, u64, 64, intrinsics::i64_add_with_overflow, intrinsics::i64_sub_with_overflow, intrinsics::i64_mul_with_overflow } @@ -1746,7 +1746,7 @@ impl u64 { #[cfg(target_pointer_width = "32")] #[lang = "usize"] impl usize { - uint_impl! { uint = u32, 32, + uint_impl! { usize = u32, 32, intrinsics::ctpop32, intrinsics::ctlz32, intrinsics::cttz32, @@ -1759,7 +1759,7 @@ impl usize { #[cfg(target_pointer_width = "64")] #[lang = "usize"] impl usize { - uint_impl! { uint = u64, 64, + uint_impl! { usize = u64, 64, intrinsics::ctpop64, intrinsics::ctlz64, intrinsics::cttz64, @@ -1772,11 +1772,11 @@ impl usize { /// A generic trait for converting a value to a number. #[unstable(feature = "core", reason = "trait is likely to be removed")] pub trait ToPrimitive { - /// Converts the value of `self` to an `int`. + /// Converts the value of `self` to an `isize`. #[inline] #[unstable(feature = "core")] #[deprecated(since = "1.0.0", reason = "use to_isize")] - fn to_int(&self) -> Option<int> { + fn to_int(&self) -> Option<isize> { self.to_i64().and_then(|x| x.to_isize()) } @@ -1807,11 +1807,11 @@ pub trait ToPrimitive { /// Converts the value of `self` to an `i64`. fn to_i64(&self) -> Option<i64>; - /// Converts the value of `self` to an `uint`. + /// Converts the value of `self` to an `usize`. #[inline] #[unstable(feature = "core")] #[deprecated(since = "1.0.0", reason = "use to_usize")] - fn to_uint(&self) -> Option<uint> { + fn to_uint(&self) -> Option<usize> { self.to_u64().and_then(|x| x.to_usize()) } @@ -1893,7 +1893,7 @@ macro_rules! impl_to_primitive_int { ($T:ty) => ( impl ToPrimitive for $T { #[inline] - fn to_int(&self) -> Option<int> { impl_to_primitive_int_to_int!($T, int, *self) } + fn to_int(&self) -> Option<isize> { impl_to_primitive_int_to_int!($T, isize, *self) } #[inline] fn to_isize(&self) -> Option<isize> { impl_to_primitive_int_to_int!($T, isize, *self) } #[inline] @@ -1906,7 +1906,7 @@ macro_rules! impl_to_primitive_int { fn to_i64(&self) -> Option<i64> { impl_to_primitive_int_to_int!($T, i64, *self) } #[inline] - fn to_uint(&self) -> Option<uint> { impl_to_primitive_int_to_uint!($T, uint, *self) } + fn to_uint(&self) -> Option<usize> { impl_to_primitive_int_to_uint!($T, usize, *self) } #[inline] fn to_usize(&self) -> Option<usize> { impl_to_primitive_int_to_uint!($T, usize, *self) } #[inline] @@ -1967,9 +1967,9 @@ macro_rules! impl_to_primitive_uint { ($T:ty) => ( impl ToPrimitive for $T { #[inline] - fn to_int(&self) -> Option<int> { impl_to_primitive_uint_to_int!(int, *self) } + fn to_int(&self) -> Option<isize> { impl_to_primitive_uint_to_int!(isize, *self) } #[inline] - fn to_isize(&self) -> Option<int> { impl_to_primitive_uint_to_int!(isize, *self) } + fn to_isize(&self) -> Option<isize> { impl_to_primitive_uint_to_int!(isize, *self) } #[inline] fn to_i8(&self) -> Option<i8> { impl_to_primitive_uint_to_int!(i8, *self) } #[inline] @@ -1980,9 +1980,11 @@ macro_rules! impl_to_primitive_uint { fn to_i64(&self) -> Option<i64> { impl_to_primitive_uint_to_int!(i64, *self) } #[inline] - fn to_uint(&self) -> Option<uint> { impl_to_primitive_uint_to_uint!($T, uint, *self) } + fn to_uint(&self) -> Option<usize> { impl_to_primitive_uint_to_uint!($T, usize, *self) } #[inline] - fn to_usize(&self) -> Option<uint> { impl_to_primitive_uint_to_uint!($T, usize, *self) } + fn to_usize(&self) -> Option<usize> { + impl_to_primitive_uint_to_uint!($T, usize, *self) + } #[inline] fn to_u8(&self) -> Option<u8> { impl_to_primitive_uint_to_uint!($T, u8, *self) } #[inline] @@ -2026,9 +2028,9 @@ macro_rules! impl_to_primitive_float { ($T:ident) => ( impl ToPrimitive for $T { #[inline] - fn to_int(&self) -> Option<int> { Some(*self as int) } + fn to_int(&self) -> Option<isize> { Some(*self as isize) } #[inline] - fn to_isize(&self) -> Option<int> { Some(*self as isize) } + fn to_isize(&self) -> Option<isize> { Some(*self as isize) } #[inline] fn to_i8(&self) -> Option<i8> { Some(*self as i8) } #[inline] @@ -2039,9 +2041,9 @@ macro_rules! impl_to_primitive_float { fn to_i64(&self) -> Option<i64> { Some(*self as i64) } #[inline] - fn to_uint(&self) -> Option<uint> { Some(*self as uint) } + fn to_uint(&self) -> Option<usize> { Some(*self as usize) } #[inline] - fn to_usize(&self) -> Option<uint> { Some(*self as usize) } + fn to_usize(&self) -> Option<usize> { Some(*self as usize) } #[inline] fn to_u8(&self) -> Option<u8> { Some(*self as u8) } #[inline] @@ -2065,12 +2067,12 @@ impl_to_primitive_float! { f64 } /// A generic trait for converting a number to a value. #[unstable(feature = "core", reason = "trait is likely to be removed")] pub trait FromPrimitive : ::marker::Sized { - /// Convert an `int` to return an optional value of this type. If the + /// Convert an `isize` to return an optional value of this type. If the /// value cannot be represented by this value, the `None` is returned. #[inline] #[unstable(feature = "core")] #[deprecated(since = "1.0.0", reason = "use from_isize")] - fn from_int(n: int) -> Option<Self> { + fn from_int(n: isize) -> Option<Self> { FromPrimitive::from_i64(n as i64) } @@ -2106,12 +2108,12 @@ pub trait FromPrimitive : ::marker::Sized { /// type cannot be represented by this value, the `None` is returned. fn from_i64(n: i64) -> Option<Self>; - /// Convert an `uint` to return an optional value of this type. If the + /// Convert an `usize` to return an optional value of this type. If the /// type cannot be represented by this value, the `None` is returned. #[inline] #[unstable(feature = "core")] #[deprecated(since = "1.0.0", reason = "use from_usize")] - fn from_uint(n: uint) -> Option<Self> { + fn from_uint(n: usize) -> Option<Self> { FromPrimitive::from_u64(n as u64) } @@ -2165,7 +2167,7 @@ pub trait FromPrimitive : ::marker::Sized { /// A utility function that just calls `FromPrimitive::from_int`. #[unstable(feature = "core", reason = "likely to be removed")] #[deprecated(since = "1.0.0", reason = "use from_isize")] -pub fn from_int<A: FromPrimitive>(n: int) -> Option<A> { +pub fn from_int<A: FromPrimitive>(n: isize) -> Option<A> { FromPrimitive::from_isize(n) } @@ -2202,7 +2204,7 @@ pub fn from_i64<A: FromPrimitive>(n: i64) -> Option<A> { /// A utility function that just calls `FromPrimitive::from_uint`. #[unstable(feature = "core", reason = "likely to be removed")] #[deprecated(since = "1.0.0", reason = "use from_uint")] -pub fn from_uint<A: FromPrimitive>(n: uint) -> Option<A> { +pub fn from_uint<A: FromPrimitive>(n: usize) -> Option<A> { FromPrimitive::from_usize(n) } @@ -2252,13 +2254,13 @@ macro_rules! impl_from_primitive { ($T:ty, $to_ty:ident) => ( #[allow(deprecated)] impl FromPrimitive for $T { - #[inline] fn from_int(n: int) -> Option<$T> { n.$to_ty() } + #[inline] fn from_int(n: isize) -> Option<$T> { n.$to_ty() } #[inline] fn from_i8(n: i8) -> Option<$T> { n.$to_ty() } #[inline] fn from_i16(n: i16) -> Option<$T> { n.$to_ty() } #[inline] fn from_i32(n: i32) -> Option<$T> { n.$to_ty() } #[inline] fn from_i64(n: i64) -> Option<$T> { n.$to_ty() } - #[inline] fn from_uint(n: uint) -> Option<$T> { n.$to_ty() } + #[inline] fn from_uint(n: usize) -> Option<$T> { n.$to_ty() } #[inline] fn from_u8(n: u8) -> Option<$T> { n.$to_ty() } #[inline] fn from_u16(n: u16) -> Option<$T> { n.$to_ty() } #[inline] fn from_u32(n: u32) -> Option<$T> { n.$to_ty() } @@ -2270,12 +2272,12 @@ macro_rules! impl_from_primitive { ) } -impl_from_primitive! { int, to_int } +impl_from_primitive! { isize, to_int } impl_from_primitive! { i8, to_i8 } impl_from_primitive! { i16, to_i16 } impl_from_primitive! { i32, to_i32 } impl_from_primitive! { i64, to_i64 } -impl_from_primitive! { uint, to_uint } +impl_from_primitive! { usize, to_uint } impl_from_primitive! { u8, to_u8 } impl_from_primitive! { u16, to_u16 } impl_from_primitive! { u32, to_u32 } @@ -2327,12 +2329,12 @@ impl_num_cast! { u8, to_u8 } impl_num_cast! { u16, to_u16 } impl_num_cast! { u32, to_u32 } impl_num_cast! { u64, to_u64 } -impl_num_cast! { uint, to_uint } +impl_num_cast! { usize, to_uint } impl_num_cast! { i8, to_i8 } impl_num_cast! { i16, to_i16 } impl_num_cast! { i32, to_i32 } impl_num_cast! { i64, to_i64 } -impl_num_cast! { int, to_int } +impl_num_cast! { isize, to_int } impl_num_cast! { f32, to_f32 } impl_num_cast! { f64, to_f64 } @@ -2392,12 +2394,12 @@ pub trait Float #[deprecated(since = "1.0.0", reason = "use `std::f32::MANTISSA_DIGITS` or \ `std::f64::MANTISSA_DIGITS` as appropriate")] - fn mantissa_digits(unused_self: Option<Self>) -> uint; + fn mantissa_digits(unused_self: Option<Self>) -> usize; /// Returns the number of base-10 digits of precision that this type supports. #[unstable(feature = "core")] #[deprecated(since = "1.0.0", reason = "use `std::f32::DIGITS` or `std::f64::DIGITS` as appropriate")] - fn digits(unused_self: Option<Self>) -> uint; + fn digits(unused_self: Option<Self>) -> usize; /// Returns the difference between 1.0 and the smallest representable number larger than 1.0. #[unstable(feature = "core")] #[deprecated(since = "1.0.0", @@ -2407,22 +2409,22 @@ pub trait Float #[unstable(feature = "core")] #[deprecated(since = "1.0.0", reason = "use `std::f32::MIN_EXP` or `std::f64::MIN_EXP` as appropriate")] - fn min_exp(unused_self: Option<Self>) -> int; + fn min_exp(unused_self: Option<Self>) -> isize; /// Returns the maximum binary exponent that this type can represent. #[unstable(feature = "core")] #[deprecated(since = "1.0.0", reason = "use `std::f32::MAX_EXP` or `std::f64::MAX_EXP` as appropriate")] - fn max_exp(unused_self: Option<Self>) -> int; + fn max_exp(unused_self: Option<Self>) -> isize; /// Returns the minimum base-10 exponent that this type can represent. #[unstable(feature = "core")] #[deprecated(since = "1.0.0", reason = "use `std::f32::MIN_10_EXP` or `std::f64::MIN_10_EXP` as appropriate")] - fn min_10_exp(unused_self: Option<Self>) -> int; + fn min_10_exp(unused_self: Option<Self>) -> isize; /// Returns the maximum base-10 exponent that this type can represent. #[unstable(feature = "core")] #[deprecated(since = "1.0.0", reason = "use `std::f32::MAX_10_EXP` or `std::f64::MAX_10_EXP` as appropriate")] - fn max_10_exp(unused_self: Option<Self>) -> int; + fn max_10_exp(unused_self: Option<Self>) -> isize; /// Returns the smallest finite value that this type can represent. #[unstable(feature = "core")] #[deprecated(since = "1.0.0", @@ -2625,7 +2627,7 @@ macro_rules! from_str_radix_float_impl { let mut prev_sig = sig; let mut cs = src.chars().enumerate(); // Exponent prefix and exponent index offset - let mut exp_info = None::<(char, uint)>; + let mut exp_info = None::<(char, usize)>; // Parse the integer part of the significand for (i, c) in cs.by_ref() { @@ -2636,9 +2638,9 @@ macro_rules! from_str_radix_float_impl { // add/subtract current digit depending on sign if is_positive { - sig = sig + ((digit as int) as $T); + sig = sig + ((digit as isize) as $T); } else { - sig = sig - ((digit as int) as $T); + sig = sig - ((digit as isize) as $T); } // Detect overflow by comparing to last value, except @@ -2719,9 +2721,9 @@ macro_rules! from_str_radix_float_impl { // Parse the exponent as decimal integer let src = &src[offset..]; let (is_positive, exp) = match src.slice_shift_char() { - Some(('-', src)) => (false, src.parse::<uint>()), - Some(('+', src)) => (true, src.parse::<uint>()), - Some((_, _)) => (true, src.parse::<uint>()), + Some(('-', src)) => (false, src.parse::<usize>()), + Some(('+', src)) => (true, src.parse::<usize>()), + Some((_, _)) => (true, src.parse::<usize>()), None => return Err(PFE { kind: Invalid }), }; diff --git a/src/libcore/num/wrapping.rs b/src/libcore/num/wrapping.rs index f8fc4ef27a1..7e02c71a2a0 100644 --- a/src/libcore/num/wrapping.rs +++ b/src/libcore/num/wrapping.rs @@ -64,7 +64,7 @@ macro_rules! wrapping_impl { )*) } -wrapping_impl! { uint u8 u16 u32 u64 int i8 i16 i32 i64 } +wrapping_impl! { usize u8 u16 u32 u64 isize i8 i16 i32 i64 } #[unstable(feature = "core", reason = "may be removed, renamed, or relocated")] #[derive(PartialEq,Eq,PartialOrd,Ord,Clone,Copy)] @@ -132,20 +132,20 @@ impl<T:WrappingOps+BitAnd<Output=T>> BitAnd for Wrapping<T> { } } -impl<T:WrappingOps+Shl<uint,Output=T>> Shl<uint> for Wrapping<T> { +impl<T:WrappingOps+Shl<usize,Output=T>> Shl<usize> for Wrapping<T> { type Output = Wrapping<T>; #[inline(always)] - fn shl(self, other: uint) -> Wrapping<T> { + fn shl(self, other: usize) -> Wrapping<T> { Wrapping(self.0 << other) } } -impl<T:WrappingOps+Shr<uint,Output=T>> Shr<uint> for Wrapping<T> { +impl<T:WrappingOps+Shr<usize,Output=T>> Shr<usize> for Wrapping<T> { type Output = Wrapping<T>; #[inline(always)] - fn shr(self, other: uint) -> Wrapping<T> { + fn shr(self, other: usize) -> Wrapping<T> { Wrapping(self.0 >> other) } } diff --git a/src/libcore/panicking.rs b/src/libcore/panicking.rs index 377b5b57ae1..d6e00df1fd7 100644 --- a/src/libcore/panicking.rs +++ b/src/libcore/panicking.rs @@ -16,7 +16,7 @@ //! interface for panicking is: //! //! ```ignore -//! fn panic_impl(fmt: fmt::Arguments, &(&'static str, uint)) -> !; +//! fn panic_impl(fmt: fmt::Arguments, &(&'static str, usize)) -> !; //! ``` //! //! This definition allows for panicking with any general message, but it does not @@ -58,8 +58,8 @@ pub fn panic_fmt(fmt: fmt::Arguments, file_line: &(&'static str, u32)) -> ! { #[allow(improper_ctypes)] extern { #[lang = "panic_fmt"] - fn panic_impl(fmt: fmt::Arguments, file: &'static str, line: uint) -> !; + fn panic_impl(fmt: fmt::Arguments, file: &'static str, line: usize) -> !; } let (file, line) = *file_line; - unsafe { panic_impl(fmt, file, line as uint) } + unsafe { panic_impl(fmt, file, line as usize) } } diff --git a/src/libcore/result.rs b/src/libcore/result.rs index 62e1bcd827a..c17a1349370 100644 --- a/src/libcore/result.rs +++ b/src/libcore/result.rs @@ -60,22 +60,22 @@ //! that make working with it more succinct. //! //! ``` -//! let good_result: Result<int, int> = Ok(10); -//! let bad_result: Result<int, int> = Err(10); +//! let good_result: Result<i32, i32> = Ok(10); +//! let bad_result: Result<i32, i32> = Err(10); //! //! // The `is_ok` and `is_err` methods do what they say. //! assert!(good_result.is_ok() && !good_result.is_err()); //! assert!(bad_result.is_err() && !bad_result.is_ok()); //! //! // `map` consumes the `Result` and produces another. -//! let good_result: Result<int, int> = good_result.map(|i| i + 1); -//! let bad_result: Result<int, int> = bad_result.map(|i| i - 1); +//! let good_result: Result<i32, i32> = good_result.map(|i| i + 1); +//! let bad_result: Result<i32, i32> = bad_result.map(|i| i - 1); //! //! // Use `and_then` to continue the computation. -//! let good_result: Result<bool, int> = good_result.and_then(|i| Ok(i == 11)); +//! let good_result: Result<bool, i32> = good_result.and_then(|i| Ok(i == 11)); //! //! // Use `or_else` to handle the error. -//! let bad_result: Result<int, int> = bad_result.or_else(|i| Ok(11)); +//! let bad_result: Result<i32, i32> = bad_result.or_else(|i| Ok(11)); //! //! // Consume the result and return the contents with `unwrap`. //! let final_awesome_result = good_result.unwrap(); @@ -182,8 +182,8 @@ //! //! struct Info { //! name: String, -//! age: int, -//! rating: int +//! age: i32, +//! rating: i32, //! } //! //! fn write_info(info: &Info) -> Result<(), IoError> { @@ -208,8 +208,8 @@ //! //! struct Info { //! name: String, -//! age: int, -//! rating: int +//! age: i32, +//! rating: i32, //! } //! //! fn write_info(info: &Info) -> Result<(), IoError> { @@ -282,10 +282,10 @@ impl<T, E> Result<T, E> { /// # Examples /// /// ``` - /// let x: Result<int, &str> = Ok(-3); + /// let x: Result<i32, &str> = Ok(-3); /// assert_eq!(x.is_ok(), true); /// - /// let x: Result<int, &str> = Err("Some error message"); + /// let x: Result<i32, &str> = Err("Some error message"); /// assert_eq!(x.is_ok(), false); /// ``` #[inline] @@ -302,10 +302,10 @@ impl<T, E> Result<T, E> { /// # Examples /// /// ``` - /// let x: Result<int, &str> = Ok(-3); + /// let x: Result<i32, &str> = Ok(-3); /// assert_eq!(x.is_err(), false); /// - /// let x: Result<int, &str> = Err("Some error message"); + /// let x: Result<i32, &str> = Err("Some error message"); /// assert_eq!(x.is_err(), true); /// ``` #[inline] @@ -392,18 +392,18 @@ impl<T, E> Result<T, E> { /// Convert from `Result<T, E>` to `Result<&mut T, &mut E>` /// /// ``` - /// fn mutate(r: &mut Result<int, int>) { + /// fn mutate(r: &mut Result<i32, i32>) { /// match r.as_mut() { /// Ok(&mut ref mut v) => *v = 42, /// Err(&mut ref mut e) => *e = 0, /// } /// } /// - /// let mut x: Result<int, int> = Ok(2); + /// let mut x: Result<i32, i32> = Ok(2); /// mutate(&mut x); /// assert_eq!(x.unwrap(), 42); /// - /// let mut x: Result<int, int> = Err(13); + /// let mut x: Result<i32, i32> = Err(13); /// mutate(&mut x); /// assert_eq!(x.unwrap_err(), 0); /// ``` @@ -486,8 +486,8 @@ impl<T, E> Result<T, E> { /// while !buffer.is_empty() { /// let line: IoResult<String> = buffer.read_line(); /// // Convert the string line to a number using `map` and `from_str` - /// let val: IoResult<int> = line.map(|line| { - /// line.trim_right().parse::<int>().unwrap_or(0) + /// let val: IoResult<i32> = line.map(|line| { + /// line.trim_right().parse::<i32>().unwrap_or(0) /// }); /// // Add the value if there were no errors, otherwise add 0 /// sum += val.unwrap_or(0); diff --git a/src/libcore/str/mod.rs b/src/libcore/str/mod.rs index a629e0308e9..1f8e73e9ddc 100644 --- a/src/libcore/str/mod.rs +++ b/src/libcore/str/mod.rs @@ -1704,7 +1704,7 @@ impl StrExt for str { #[inline] unsafe fn slice_unchecked(&self, begin: usize, end: usize) -> &str { mem::transmute(Slice { - data: self.as_ptr().offset(begin as int), + data: self.as_ptr().offset(begin as isize), len: end - begin, }) } |
