From 79318b7c3b876a96c6f397617574bc1bfb6090df Mon Sep 17 00:00:00 2001 From: "Felix S. Klock II" Date: Mon, 16 Feb 2015 14:38:50 +0100 Subject: [PATCH 1/3] Update `core::mem` for `isize/usize` migration. --- src/libcore/mem.rs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/libcore/mem.rs b/src/libcore/mem.rs index 51bf3c1648f56..740997b7a249d 100644 --- a/src/libcore/mem.rs +++ b/src/libcore/mem.rs @@ -43,7 +43,7 @@ pub use intrinsics::forget; /// ``` #[inline] #[stable(feature = "rust1", since = "1.0.0")] -pub fn size_of() -> uint { +pub fn size_of() -> usize { unsafe { intrinsics::size_of::() } } @@ -58,7 +58,7 @@ pub fn size_of() -> uint { /// ``` #[inline] #[stable(feature = "rust1", since = "1.0.0")] -pub fn size_of_val(_val: &T) -> uint { +pub fn size_of_val(_val: &T) -> usize { size_of::() } @@ -75,7 +75,7 @@ pub fn size_of_val(_val: &T) -> uint { /// ``` #[inline] #[stable(feature = "rust1", since = "1.0.0")] -pub fn min_align_of() -> uint { +pub fn min_align_of() -> usize { unsafe { intrinsics::min_align_of::() } } @@ -90,7 +90,7 @@ pub fn min_align_of() -> uint { /// ``` #[inline] #[stable(feature = "rust1", since = "1.0.0")] -pub fn min_align_of_val(_val: &T) -> uint { +pub fn min_align_of_val(_val: &T) -> usize { min_align_of::() } @@ -108,7 +108,7 @@ pub fn min_align_of_val(_val: &T) -> uint { /// ``` #[inline] #[stable(feature = "rust1", since = "1.0.0")] -pub fn align_of() -> uint { +pub fn align_of() -> usize { // We use the preferred alignment as the default alignment for a type. This // appears to be what clang migrated towards as well: // @@ -130,7 +130,7 @@ pub fn align_of() -> uint { /// ``` #[inline] #[stable(feature = "rust1", since = "1.0.0")] -pub fn align_of_val(_val: &T) -> uint { +pub fn align_of_val(_val: &T) -> usize { align_of::() } @@ -150,7 +150,7 @@ pub fn align_of_val(_val: &T) -> uint { /// ``` /// use std::mem; /// -/// let x: int = unsafe { mem::zeroed() }; +/// let x: i32 = unsafe { mem::zeroed() }; /// ``` #[inline] #[stable(feature = "rust1", since = "1.0.0")] @@ -171,7 +171,7 @@ pub unsafe fn zeroed() -> T { /// ``` /// use std::mem; /// -/// let x: int = unsafe { mem::uninitialized() }; +/// let x: i32 = unsafe { mem::uninitialized() }; /// ``` #[inline] #[stable(feature = "rust1", since = "1.0.0")] From a97588c34b1d7aa442706ce2cf7a66375f695c6b Mon Sep 17 00:00:00 2001 From: "Felix S. Klock II" Date: Mon, 16 Feb 2015 14:39:35 +0100 Subject: [PATCH 2/3] Update `core::nonzero` for `isize/usize` migration. --- src/libcore/nonzero.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/libcore/nonzero.rs b/src/libcore/nonzero.rs index 3f83302742c8c..5644f76306929 100644 --- a/src/libcore/nonzero.rs +++ b/src/libcore/nonzero.rs @@ -19,8 +19,8 @@ pub unsafe trait Zeroable {} unsafe impl Zeroable for *const T {} unsafe impl Zeroable for *mut T {} unsafe impl Zeroable for Unique { } -unsafe impl Zeroable for int {} -unsafe impl Zeroable for uint {} +unsafe impl Zeroable for isize {} +unsafe impl Zeroable for usize {} unsafe impl Zeroable for i8 {} unsafe impl Zeroable for u8 {} unsafe impl Zeroable for i16 {} From 480ea5ac55d99b9cf52f4df157a532005cd3ed75 Mon Sep 17 00:00:00 2001 From: "Felix S. Klock II" Date: Mon, 16 Feb 2015 14:41:33 +0100 Subject: [PATCH 3/3] Update `core::cell` for `isize/usize` transition. --- src/libcore/cell.rs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/libcore/cell.rs b/src/libcore/cell.rs index cf293ded13f00..5d351adfca06b 100644 --- a/src/libcore/cell.rs +++ b/src/libcore/cell.rs @@ -78,12 +78,12 @@ //! use std::cell::RefCell; //! //! struct Graph { -//! edges: Vec<(uint, uint)>, -//! span_tree_cache: RefCell>> +//! edges: Vec<(i32, i32)>, +//! span_tree_cache: RefCell>> //! } //! //! impl Graph { -//! fn minimum_spanning_tree(&self) -> Vec<(uint, uint)> { +//! fn minimum_spanning_tree(&self) -> Vec<(i32, i32)> { //! // Create a new scope to contain the lifetime of the //! // dynamic borrow //! { @@ -104,7 +104,7 @@ //! // This is the major hazard of using `RefCell`. //! self.minimum_spanning_tree() //! } -//! # fn calc_span_tree(&self) -> Vec<(uint, uint)> { vec![] } +//! # fn calc_span_tree(&self) -> Vec<(i32, i32)> { vec![] } //! } //! ``` //! @@ -125,7 +125,7 @@ //! //! struct RcBox { //! value: T, -//! refcount: Cell +//! refcount: Cell //! } //! //! impl Clone for Rc { @@ -279,8 +279,8 @@ pub enum BorrowState { } // Values [1, MAX-1] represent the number of `Ref` active -// (will not outgrow its range since `uint` is the size of the address space) -type BorrowFlag = uint; +// (will not outgrow its range since `usize` is the size of the address space) +type BorrowFlag = usize; const UNUSED: BorrowFlag = 0; const WRITING: BorrowFlag = -1;