Skip to content

Commit 7deb9ab

Browse files
committed
Add isize, usize modules, deprecate int, uint modules
This PR introduces `isize` and `usize` modules to `core` and `std`, and deprecates the existing `int` and `uint` modules. The rustdoc primitive type links now point to these new modules. Due to deprecation this is a: [breaking-change]
1 parent b53e9f1 commit 7deb9ab

File tree

10 files changed

+113
-12
lines changed

10 files changed

+113
-12
lines changed

src/libcore/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,12 +78,14 @@ mod int_macros;
7878
mod uint_macros;
7979

8080
#[path = "num/int.rs"] pub mod int;
81+
#[path = "num/isize.rs"] pub mod isize;
8182
#[path = "num/i8.rs"] pub mod i8;
8283
#[path = "num/i16.rs"] pub mod i16;
8384
#[path = "num/i32.rs"] pub mod i32;
8485
#[path = "num/i64.rs"] pub mod i64;
8586

8687
#[path = "num/uint.rs"] pub mod uint;
88+
#[path = "num/usize.rs"] pub mod usize;
8789
#[path = "num/u8.rs"] pub mod u8;
8890
#[path = "num/u16.rs"] pub mod u16;
8991
#[path = "num/u32.rs"] pub mod u32;

src/libcore/num/int.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,13 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
//! Operations and constants for architecture-sized signed integers (`int` type)
11+
//! Deprecated: replaced by `isize`.
12+
//!
13+
//! The rollout of the new type will gradually take place over the
14+
//! alpha cycle along with the development of clearer conventions
15+
//! around integer types.
1216
13-
#![stable]
14-
#![doc(primitive = "int")]
17+
#![deprecated = "replaced by isize"]
1518

1619
#[cfg(target_word_size = "32")] int_module! { int, 32 }
1720
#[cfg(target_word_size = "64")] int_module! { int, 64 }

src/libcore/num/isize.rs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
//! Operations and constants for pointer-sized signed integers (`isize` type)
12+
//!
13+
//! This type was recently added to replace `int`. The rollout of the
14+
//! new type will gradually take place over the alpha cycle along with
15+
//! the development of clearer conventions around integer types.
16+
17+
#![stable]
18+
#![doc(primitive = "isize")]
19+
20+
#[cfg(target_word_size = "32")] int_module! { isize, 32 }
21+
#[cfg(target_word_size = "64")] int_module! { isize, 64 }

src/libcore/num/uint.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,12 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
//! Operations and constants for architecture-sized unsigned integers (`uint` type)
11+
//! Deprecated: replaced by `usize`.
12+
//!
13+
//! The rollout of the new type will gradually take place over the
14+
//! alpha cycle along with the development of clearer conventions
15+
//! around integer types.
1216
13-
#![stable]
14-
#![doc(primitive = "uint")]
17+
#![deprecated = "replaced by usize"]
1518

1619
uint_module! { uint, int, ::int::BITS }

src/libcore/num/usize.rs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
//! Operations and constants for pointer-sized unsigned integers (`usize` type)
12+
//!
13+
//! This type was recently added to replace `uint`. The rollout of the
14+
//! new type will gradually take place over the alpha cycle along with
15+
//! the development of clearer conventions around integer types.
16+
17+
#![stable]
18+
#![doc(primitive = "usize")]
19+
20+
uint_module! { usize, isize, ::isize::BITS }

src/libstd/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,12 +201,14 @@ mod int_macros;
201201
mod uint_macros;
202202

203203
#[path = "num/int.rs"] pub mod int;
204+
#[path = "num/isize.rs"] pub mod isize;
204205
#[path = "num/i8.rs"] pub mod i8;
205206
#[path = "num/i16.rs"] pub mod i16;
206207
#[path = "num/i32.rs"] pub mod i32;
207208
#[path = "num/i64.rs"] pub mod i64;
208209

209210
#[path = "num/uint.rs"] pub mod uint;
211+
#[path = "num/usize.rs"] pub mod usize;
210212
#[path = "num/u8.rs"] pub mod u8;
211213
#[path = "num/u16.rs"] pub mod u16;
212214
#[path = "num/u32.rs"] pub mod u32;

src/libstd/num/int.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,13 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
//! Operations and constants for architecture-sized signed integers (`int` type)
11+
//! Deprecated: replaced by `isize`.
12+
//!
13+
//! The rollout of the new type will gradually take place over the
14+
//! alpha cycle along with the development of clearer conventions
15+
//! around integer types.
1216
13-
#![stable]
14-
#![doc(primitive = "int")]
17+
#![deprecated = "replaced by isize"]
1518

1619
pub use core::int::{BITS, BYTES, MIN, MAX};
1720

src/libstd/num/isize.rs

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
//! Operations and constants for pointer-sized signed integers (`isize` type)
12+
//!
13+
//! This type was recently added to replace `int`. The rollout of the
14+
//! new type will gradually take place over the alpha cycle along with
15+
//! the development of clearer conventions around integer types.
16+
17+
#![stable]
18+
#![doc(primitive = "isize")]
19+
20+
pub use core::isize::{BITS, BYTES, MIN, MAX};
21+
22+
int_module! { isize }

src/libstd/num/uint.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,13 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
//! Operations and constants for architecture-sized unsigned integers (`uint` type)
11+
//! Deprecated: replaced by `usize`.
12+
//!
13+
//! The rollout of the new type will gradually take place over the
14+
//! alpha cycle along with the development of clearer conventions
15+
//! around integer types.
1216
13-
#![stable]
14-
#![doc(primitive = "uint")]
17+
#![deprecated = "replaced by usize"]
1518

1619
pub use core::uint::{BITS, BYTES, MIN, MAX};
1720

src/libstd/num/usize.rs

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
//! Operations and constants for pointer-sized unsigned integers (`usize` type)
12+
//!
13+
//! This type was recently added to replace `uint`. The rollout of the
14+
//! new type will gradually take place over the alpha cycle along with
15+
//! the development of clearer conventions around integer types.
16+
17+
#![stable]
18+
#![doc(primitive = "usize")]
19+
20+
pub use core::usize::{BITS, BYTES, MIN, MAX};
21+
22+
uint_module! { usize }

0 commit comments

Comments
 (0)