Skip to content

Commit

Permalink
Mass rename uint/int to usize/isize
Browse files Browse the repository at this point in the history
Now that support has been removed, all lingering use cases are renamed.
  • Loading branch information
alexcrichton committed Mar 26, 2015
1 parent 54f16b8 commit 43bfaa4
Show file tree
Hide file tree
Showing 1,391 changed files with 5,183 additions and 5,241 deletions.
1 change: 0 additions & 1 deletion src/compiletest/compiletest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@

#![feature(box_syntax)]
#![feature(collections)]
#![feature(int_uint)]
#![feature(old_io)]
#![feature(old_path)]
#![feature(rustc_private)]
Expand Down
8 changes: 4 additions & 4 deletions src/compiletest/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@ use std::io::prelude::*;
use std::path::Path;

pub struct ExpectedError {
pub line: uint,
pub line: usize,
pub kind: String,
pub msg: String,
}

#[derive(PartialEq, Debug)]
enum WhichLine { ThisLine, FollowPrevious(uint), AdjustBackward(uint) }
enum WhichLine { ThisLine, FollowPrevious(usize), AdjustBackward(usize) }

/// Looks for either "//~| KIND MESSAGE" or "//~^^... KIND MESSAGE"
/// The former is a "follow" that inherits its target from the preceding line;
Expand Down Expand Up @@ -58,8 +58,8 @@ pub fn load_errors(testfile: &Path) -> Vec<ExpectedError> {
}).collect()
}

fn parse_expected(last_nonfollow_error: Option<uint>,
line_num: uint,
fn parse_expected(last_nonfollow_error: Option<usize>,
line_num: usize,
line: &str) -> Option<(WhichLine, ExpectedError)> {
let start = match line.find("//~") { Some(i) => i, None => return None };
let (follow, adjusts) = if line.char_at(start + 3) == '|' {
Expand Down
10 changes: 5 additions & 5 deletions src/compiletest/header.rs
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,7 @@ pub fn parse_name_value_directive(line: &str, directive: &str)
}
}

pub fn gdb_version_to_int(version_string: &str) -> int {
pub fn gdb_version_to_int(version_string: &str) -> isize {
let error_string = format!(
"Encountered GDB version string with unexpected format: {}",
version_string);
Expand All @@ -369,17 +369,17 @@ pub fn gdb_version_to_int(version_string: &str) -> int {
panic!("{}", error_string);
}

let major: int = components[0].parse().ok().expect(&error_string);
let minor: int = components[1].parse().ok().expect(&error_string);
let major: isize = components[0].parse().ok().expect(&error_string);
let minor: isize = components[1].parse().ok().expect(&error_string);

return major * 1000 + minor;
}

pub fn lldb_version_to_int(version_string: &str) -> int {
pub fn lldb_version_to_int(version_string: &str) -> isize {
let error_string = format!(
"Encountered LLDB version string with unexpected format: {}",
version_string);
let error_string = error_string;
let major: int = version_string.parse().ok().expect(&error_string);
let major: isize = version_string.parse().ok().expect(&error_string);
return major;
}
12 changes: 6 additions & 6 deletions src/compiletest/runtest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -758,7 +758,7 @@ fn run_debuginfo_lldb_test(config: &Config, props: &TestProps, testfile: &Path)
struct DebuggerCommands {
commands: Vec<String>,
check_lines: Vec<String>,
breakpoint_lines: Vec<uint>,
breakpoint_lines: Vec<usize>,
}

fn parse_debugger_commands(file_path: &Path, debugger_prefix: &str)
Expand Down Expand Up @@ -1036,7 +1036,7 @@ fn is_compiler_error_or_warning(line: &str) -> bool {
scan_string(line, "warning", &mut i));
}

fn scan_until_char(haystack: &str, needle: char, idx: &mut uint) -> bool {
fn scan_until_char(haystack: &str, needle: char, idx: &mut usize) -> bool {
if *idx >= haystack.len() {
return false;
}
Expand All @@ -1048,7 +1048,7 @@ fn scan_until_char(haystack: &str, needle: char, idx: &mut uint) -> bool {
return true;
}

fn scan_char(haystack: &str, needle: char, idx: &mut uint) -> bool {
fn scan_char(haystack: &str, needle: char, idx: &mut usize) -> bool {
if *idx >= haystack.len() {
return false;
}
Expand All @@ -1060,7 +1060,7 @@ fn scan_char(haystack: &str, needle: char, idx: &mut uint) -> bool {
return true;
}

fn scan_integer(haystack: &str, idx: &mut uint) -> bool {
fn scan_integer(haystack: &str, idx: &mut usize) -> bool {
let mut i = *idx;
while i < haystack.len() {
let ch = haystack.char_at(i);
Expand All @@ -1076,7 +1076,7 @@ fn scan_integer(haystack: &str, idx: &mut uint) -> bool {
return true;
}

fn scan_string(haystack: &str, needle: &str, idx: &mut uint) -> bool {
fn scan_string(haystack: &str, needle: &str, idx: &mut usize) -> bool {
let mut haystack_i = *idx;
let mut needle_i = 0;
while needle_i < needle.len() {
Expand Down Expand Up @@ -1725,7 +1725,7 @@ fn disassemble_extract(config: &Config, _props: &TestProps,
}


fn count_extracted_lines(p: &Path) -> uint {
fn count_extracted_lines(p: &Path) -> usize {
let mut x = Vec::new();
File::open(&p.with_extension("ll")).unwrap().read_to_end(&mut x).unwrap();
let x = str::from_utf8(&x).unwrap();
Expand Down
7 changes: 2 additions & 5 deletions src/doc/reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -2440,9 +2440,6 @@ The currently implemented features of the reference compiler are:
* `intrinsics` - Allows use of the "rust-intrinsics" ABI. Compiler intrinsics
are inherently unstable and no promise about them is made.

* `int_uint` - Allows the use of the `int` and `uint` types, which are deprecated.
Use `isize` and `usize` instead.

* `lang_items` - Allows use of the `#[lang]` attribute. Like `intrinsics`,
lang items are inherently unstable and no promise about them
is made.
Expand Down Expand Up @@ -2759,7 +2756,7 @@ The following are examples of structure expressions:
```
# struct Point { x: f64, y: f64 }
# struct TuplePoint(f64, f64);
# mod game { pub struct User<'a> { pub name: &'a str, pub age: u32, pub score: uint } }
# mod game { pub struct User<'a> { pub name: &'a str, pub age: u32, pub score: usize } }
# struct Cookie; fn some_fn<T>(t: T) {}
Point {x: 10.0, y: 20.0};
TuplePoint(10.0, 20.0);
Expand Down Expand Up @@ -3402,7 +3399,7 @@ subpattern`. For example:
#![feature(box_patterns)]
#![feature(box_syntax)]
enum List { Nil, Cons(uint, Box<List>) }
enum List { Nil, Cons(u32, Box<List>) }
fn is_sorted(list: &List) -> bool {
match *list {
Expand Down
4 changes: 2 additions & 2 deletions src/doc/trpl/ffi.md
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,7 @@ Unsafe functions, on the other hand, advertise it to the world. An unsafe functi
this:

```
unsafe fn kaboom(ptr: *const int) -> int { *ptr }
unsafe fn kaboom(ptr: *const i32) -> i32 { *ptr }
```

This function can only be called from an `unsafe` block or another `unsafe` function.
Expand All @@ -423,7 +423,7 @@ extern {
fn main() {
println!("You have readline version {} installed.",
rl_readline_version as int);
rl_readline_version as i32);
}
```

Expand Down
2 changes: 1 addition & 1 deletion src/doc/trpl/more-strings.md
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ need, and it can make your lifetimes more complex.
To write a function that's generic over types of strings, use `&str`.

```
fn some_string_length(x: &str) -> uint {
fn some_string_length(x: &str) -> usize {
x.len()
}
Expand Down
44 changes: 22 additions & 22 deletions src/libcore/atomic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand All @@ -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)]
Expand All @@ -1097,105 +1097,105 @@ 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) }
}
}

#[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) }
}
}
4 changes: 2 additions & 2 deletions src/libcore/fmt/float.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion src/libcore/intrinsics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
1 change: 0 additions & 1 deletion src/libcore/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand Down
2 changes: 1 addition & 1 deletion src/libcore/macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)"),
Expand Down
Loading

0 comments on commit 43bfaa4

Please sign in to comment.