Skip to content

Remove public references to int and uint #25843

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 28, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/doc/complement-design-faq.md
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ that all delimiters be balanced.
## `->` for function return type

This is to make the language easier to parse for humans, especially in the face
of higher-order functions. `fn foo<T>(f: fn(int): int, fn(T): U): U` is not
of higher-order functions. `fn foo<T>(f: fn(i32): i32, fn(T): U): U` is not
particularly easy to read.

## Why is `let` used to introduce variables?
Expand Down
8 changes: 4 additions & 4 deletions src/doc/style/errors/ergonomics.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ use std::io::{File, Open, Write, IoError};

struct Info {
name: String,
age: int,
rating: int
age: i32,
rating: i32
}

fn write_info(info: &Info) -> Result<(), IoError> {
Expand All @@ -36,8 +36,8 @@ use std::io::{File, Open, Write, IoError};

struct Info {
name: String,
age: int,
rating: int
age: i32,
rating: i32
}

fn write_info(info: &Info) -> Result<(), IoError> {
Expand Down
10 changes: 5 additions & 5 deletions src/doc/style/features/functions-and-methods/input.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,15 +57,15 @@ it becomes.
Prefer

```rust
fn foo<T: Iterator<int>>(c: T) { ... }
fn foo<T: Iterator<i32>>(c: T) { ... }
```

over any of

```rust
fn foo(c: &[int]) { ... }
fn foo(c: &Vec<int>) { ... }
fn foo(c: &SomeOtherCollection<int>) { ... }
fn foo(c: &[i32]) { ... }
fn foo(c: &Vec<i32>) { ... }
fn foo(c: &SomeOtherCollection<i32>) { ... }
```

if the function only needs to iterate over the data.
Expand Down Expand Up @@ -121,7 +121,7 @@ The primary exception: sometimes a function is meant to modify data
that the caller already owns, for example to re-use a buffer:

```rust
fn read(&mut self, buf: &mut [u8]) -> IoResult<uint>
fn read(&mut self, buf: &mut [u8]) -> IoResult<usize>
```

(From the [Reader trait](http://static.rust-lang.org/doc/master/std/io/trait.Reader.html#tymethod.read).)
Expand Down
4 changes: 2 additions & 2 deletions src/doc/style/features/functions-and-methods/output.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@ Prefer
```rust
struct SearchResult {
found: bool, // item in container?
expected_index: uint // what would the item's index be?
expected_index: usize // what would the item's index be?
}

fn binary_search(&self, k: Key) -> SearchResult
```
or

```rust
fn binary_search(&self, k: Key) -> (bool, uint)
fn binary_search(&self, k: Key) -> (bool, usize)
```

over
Expand Down
4 changes: 2 additions & 2 deletions src/doc/style/features/let.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
Prefer

```rust
fn use_mutex(m: sync::mutex::Mutex<int>) {
fn use_mutex(m: sync::mutex::Mutex<i32>) {
let guard = m.lock();
do_work(guard);
drop(guard); // unlock the lock
Expand All @@ -16,7 +16,7 @@ fn use_mutex(m: sync::mutex::Mutex<int>) {
over

```rust
fn use_mutex(m: sync::mutex::Mutex<int>) {
fn use_mutex(m: sync::mutex::Mutex<i32>) {
do_work(m.lock());
// do other work
}
Expand Down
2 changes: 1 addition & 1 deletion src/doc/style/features/traits/reuse.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ trait Printable {
fn print(&self) { println!("{:?}", *self) }
}

impl Printable for int {}
impl Printable for i32 {}

impl Printable for String {
fn print(&self) { println!("{}", *self) }
Expand Down
4 changes: 2 additions & 2 deletions src/doc/style/features/types/newtype.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,12 @@ promises to the client.

For example, consider a function `my_transform` that returns a compound iterator
type `Enumerate<Skip<vec::MoveItems<T>>>`. We wish to hide this type from the
client, so that the client's view of the return type is roughly `Iterator<(uint,
client, so that the client's view of the return type is roughly `Iterator<(usize,
T)>`. We can do so using the newtype pattern:

```rust
struct MyTransformResult<T>(Enumerate<Skip<vec::MoveItems<T>>>);
impl<T> Iterator<(uint, T)> for MyTransformResult<T> { ... }
impl<T> Iterator<(usize, T)> for MyTransformResult<T> { ... }

fn my_transform<T, Iter: Iterator<T>>(iter: Iter) -> MyTransformResult<T> {
...
Expand Down
2 changes: 1 addition & 1 deletion src/doc/style/style/features.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Terminate `return` statements with semicolons:

``` rust
fn foo(bar: int) -> Option<int> {
fn foo(bar: i32) -> Option<i32> {
if some_condition() {
return None;
}
Expand Down
2 changes: 1 addition & 1 deletion src/doc/style/style/imports.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ For example:
use option::Option;
use mem;

let i: int = mem::transmute(Option(0));
let i: isize = mem::transmute(Option(0));
```

> **[FIXME]** Add rationale.
2 changes: 1 addition & 1 deletion src/doc/style/style/whitespace.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

``` rust
#[deprecated = "Use `bar` instead."]
fn foo(a: uint, b: uint) -> uint {
fn foo(a: usize, b: usize) -> usize {
a + b
}
```
Expand Down
2 changes: 1 addition & 1 deletion src/doc/trpl/associated-types.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ trait Graph {
Now, our clients can be abstract over a given `Graph`:

```rust,ignore
fn distance<G: Graph>(graph: &G, start: &G::N, end: &G::N) -> uint { ... }
fn distance<G: Graph>(graph: &G, start: &G::N, end: &G::N) -> usize { ... }
```

No need to deal with the `E`dge type here!
Expand Down
2 changes: 1 addition & 1 deletion src/doc/trpl/box-syntax-and-patterns.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ fn main() {
```

The idea is that by passing around a box, you're only copying a pointer, rather
than the hundred `int`s that make up the `BigStruct`.
than the hundred `i32`s that make up the `BigStruct`.

This is an antipattern in Rust. Instead, write this:

Expand Down
2 changes: 1 addition & 1 deletion src/doc/trpl/traits.md
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ print_area(5);
We get a compile-time error:

```text
error: failed to find an implementation of trait main::HasArea for int
error: the trait `HasArea` is not implemented for the type `_` [E0277]
```

So far, we’ve only added trait implementations to structs, but you can
Expand Down
4 changes: 0 additions & 4 deletions src/libcore/num/isize.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,6 @@
// except according to those terms.

//! Operations and constants for pointer-sized signed integers (`isize` type)
//!
//! This type was recently added to replace `int`. The rollout of the
//! new type will gradually take place over the alpha cycle along with
//! the development of clearer conventions around integer types.

#![stable(feature = "rust1", since = "1.0.0")]
#![doc(primitive = "isize")]
Expand Down
4 changes: 0 additions & 4 deletions src/libcore/num/usize.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,6 @@
// except according to those terms.

//! Operations and constants for pointer-sized unsigned integers (`usize` type)
//!
//! This type was recently added to replace `uint`. The rollout of the
//! new type will gradually take place over the alpha cycle along with
//! the development of clearer conventions around integer types.

#![stable(feature = "rust1", since = "1.0.0")]
#![doc(primitive = "usize")]
Expand Down
4 changes: 0 additions & 4 deletions src/libstd/num/isize.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,6 @@
// except according to those terms.

//! Operations and constants for pointer-sized signed integers (`isize` type)
//!
//! This type was recently added to replace `int`. The rollout of the
//! new type will gradually take place over the alpha cycle along with
//! the development of clearer conventions around integer types.

#![stable(feature = "rust1", since = "1.0.0")]
#![doc(primitive = "isize")]
Expand Down
4 changes: 0 additions & 4 deletions src/libstd/num/usize.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,6 @@
// except according to those terms.

//! Operations and constants for pointer-sized unsigned integers (`usize` type)
//!
//! This type was recently added to replace `uint`. The rollout of the
//! new type will gradually take place over the alpha cycle along with
//! the development of clearer conventions around integer types.

#![stable(feature = "rust1", since = "1.0.0")]
#![doc(primitive = "usize")]
Expand Down