Skip to content

killall isize #21811

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
Feb 1, 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
6 changes: 3 additions & 3 deletions src/doc/intro.md
Original file line number Diff line number Diff line change
Expand Up @@ -424,7 +424,7 @@ Let's see an example. This Rust code will not compile:
use std::thread::Thread;

fn main() {
let mut numbers = vec![1is, 2, 3];
let mut numbers = vec![1, 2, 3];

for i in 0..3 {
Thread::spawn(move || {
Expand Down Expand Up @@ -478,7 +478,7 @@ use std::thread::Thread;
use std::sync::{Arc,Mutex};

fn main() {
let numbers = Arc::new(Mutex::new(vec![1is, 2, 3]));
let numbers = Arc::new(Mutex::new(vec![1, 2, 3]));

for i in 0us..3 {
let number = numbers.clone();
Expand Down Expand Up @@ -539,7 +539,7 @@ safety check that makes this an error about moved values:
use std::thread::Thread;

fn main() {
let vec = vec![1is, 2, 3];
let vec = vec![1, 2, 3];

for i in 0us..3 {
Thread::spawn(move || {
Expand Down
44 changes: 23 additions & 21 deletions src/doc/reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ cases mentioned in [Number literals](#number-literals) below.
##### Suffixes
| Integer | Floating-point |
|---------|----------------|
| `is` (`isize`), `us` (`usize`), `u8`, `i8`, `u16`, `i16`, `u32`, `i32`, `u64`, `i64` | `f32`, `f64` |
| `u8`, `i8`, `u16`, `i16`, `u32`, `i32`, `u64`, `i64`, `is` (`isize`), `us` (`usize`) | `f32`, `f64` |

#### Character and string literals

Expand Down Expand Up @@ -468,27 +468,29 @@ Like any literal, an integer literal may be followed (immediately,
without any spaces) by an _integer suffix_, which forcibly sets the
type of the literal. There are 10 valid values for an integer suffix:

* The `is` and `us` suffixes give the literal type `isize` or `usize`,
respectively.
* Each of the signed and unsigned machine types `u8`, `i8`,
`u16`, `i16`, `u32`, `i32`, `u64` and `i64`
give the literal the corresponding machine type.
* The `is` and `us` suffixes give the literal type `isize` or `usize`,
respectively.

The type of an _unsuffixed_ integer literal is determined by type inference.
If an integer type can be _uniquely_ determined from the surrounding program
context, the unsuffixed integer literal has that type. If the program context
underconstrains the type, it is considered a static type error; if the program
context overconstrains the type, it is also considered a static type error.
underconstrains the type, it defaults to the signed 32-bit integer `i32`; if
the program context overconstrains the type, it is considered a static type
error.

Examples of integer literals of various forms:

```
123is; // type isize
123us; // type usize
123_us; // type usize
123i32; // type i32
123u32; // type u32
123_u32; // type u32
0xff_u8; // type u8
0o70_i16; // type i16
0b1111_1111_1001_0000_i32; // type i32
0us; // type usize
```

##### Floating-point literals
Expand Down Expand Up @@ -1135,8 +1137,8 @@ used as a type name.

When a generic function is referenced, its type is instantiated based on the
context of the reference. For example, calling the `iter` function defined
above on `[1, 2]` will instantiate type parameter `T` with `isize`, and require
the closure parameter to have type `fn(isize)`.
above on `[1, 2]` will instantiate type parameter `T` with `i32`, and require
the closure parameter to have type `fn(i32)`.

The type parameters can also be explicitly supplied in a trailing
[path](#paths) component after the function name. This might be necessary if
Expand Down Expand Up @@ -2746,9 +2748,9 @@ constant expression that can be evaluated at compile time, such as a
[literal](#literals) or a [static item](#static-items).

```
[1is, 2, 3, 4];
[1, 2, 3, 4];
["a", "b", "c", "d"];
[0is; 128]; // array with 128 zeros
[0; 128]; // array with 128 zeros
[0u8, 0u8, 0u8, 0u8];
```

Expand Down Expand Up @@ -2921,7 +2923,7 @@ moves](#moved-and-copied-types) its right-hand operand to its left-hand
operand.

```
# let mut x = 0is;
# let mut x = 0;
# let y = 0;

x = y;
Expand Down Expand Up @@ -3307,11 +3309,11 @@ fn main() {
```

Patterns can also dereference pointers by using the `&`, `&mut` and `box`
symbols, as appropriate. For example, these two matches on `x: &isize` are
symbols, as appropriate. For example, these two matches on `x: &i32` are
equivalent:

```
# let x = &3is;
# let x = &3;
let y = match *x { 0 => "zero", _ => "some" };
let z = match x { &0 => "zero", _ => "some" };

Expand All @@ -3332,7 +3334,7 @@ Multiple match patterns may be joined with the `|` operator. A range of values
may be specified with `...`. For example:

```
# let x = 2is;
# let x = 2;

let message = match x {
0 | 1 => "not many",
Expand Down Expand Up @@ -3673,16 +3675,16 @@ The type of a closure mapping an input of type `A` to an output of type `B` is
An example of creating and calling a closure:

```rust
let captured_var = 10is;
let captured_var = 10;

let closure_no_args = |&:| println!("captured_var={}", captured_var);

let closure_args = |&: arg: isize| -> isize {
let closure_args = |&: arg: i32| -> i32 {
println!("captured_var={}, arg={}", captured_var, arg);
arg // Note lack of semicolon after 'arg'
};

fn call_closure<F: Fn(), G: Fn(isize) -> isize>(c1: F, c2: G) {
fn call_closure<F: Fn(), G: Fn(i32) -> i32>(c1: F, c2: G) {
c1();
c2(2);
}
Expand Down Expand Up @@ -3714,7 +3716,7 @@ trait Printable {
fn stringify(&self) -> String;
}

impl Printable for isize {
impl Printable for i32 {
fn stringify(&self) -> String { self.to_string() }
}

Expand All @@ -3723,7 +3725,7 @@ fn print(a: Box<Printable>) {
}

fn main() {
print(Box::new(10is) as Box<Printable>);
print(Box::new(10) as Box<Printable>);
}
```

Expand Down
30 changes: 15 additions & 15 deletions src/libcollections/dlist.rs
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ impl<T> DList<T> {
///
/// let mut dl = DList::new();
///
/// dl.push_front(2is);
/// dl.push_front(2);
/// assert_eq!(dl.len(), 1);
///
/// dl.push_front(1);
Expand All @@ -360,10 +360,10 @@ impl<T> DList<T> {
///
/// let mut dl = DList::new();
///
/// dl.push_front(2is);
/// dl.push_front(2);
/// dl.push_front(1);
/// assert_eq!(dl.len(), 2);
/// assert_eq!(dl.front(), Some(&1is));
/// assert_eq!(dl.front(), Some(&1));
///
/// dl.clear();
/// assert_eq!(dl.len(), 0);
Expand All @@ -388,7 +388,7 @@ impl<T> DList<T> {
/// assert_eq!(dl.front(), None);
///
/// dl.push_front(1);
/// assert_eq!(dl.front(), Some(&1is));
/// assert_eq!(dl.front(), Some(&1));
///
/// ```
#[inline]
Expand All @@ -409,13 +409,13 @@ impl<T> DList<T> {
/// assert_eq!(dl.front(), None);
///
/// dl.push_front(1);
/// assert_eq!(dl.front(), Some(&1is));
/// assert_eq!(dl.front(), Some(&1));
///
/// match dl.front_mut() {
/// None => {},
/// Some(x) => *x = 5is,
/// Some(x) => *x = 5,
/// }
/// assert_eq!(dl.front(), Some(&5is));
/// assert_eq!(dl.front(), Some(&5));
///
/// ```
#[inline]
Expand All @@ -436,7 +436,7 @@ impl<T> DList<T> {
/// assert_eq!(dl.back(), None);
///
/// dl.push_back(1);
/// assert_eq!(dl.back(), Some(&1is));
/// assert_eq!(dl.back(), Some(&1));
///
/// ```
#[inline]
Expand All @@ -457,13 +457,13 @@ impl<T> DList<T> {
/// assert_eq!(dl.back(), None);
///
/// dl.push_back(1);
/// assert_eq!(dl.back(), Some(&1is));
/// assert_eq!(dl.back(), Some(&1));
///
/// match dl.back_mut() {
/// None => {},
/// Some(x) => *x = 5is,
/// Some(x) => *x = 5,
/// }
/// assert_eq!(dl.back(), Some(&5is));
/// assert_eq!(dl.back(), Some(&5));
///
/// ```
#[inline]
Expand All @@ -483,8 +483,8 @@ impl<T> DList<T> {
///
/// let mut dl = DList::new();
///
/// dl.push_front(2is);
/// assert_eq!(dl.front().unwrap(), &2is);
/// dl.push_front(2);
/// assert_eq!(dl.front().unwrap(), &2);
///
/// dl.push_front(1);
/// assert_eq!(dl.front().unwrap(), &1);
Expand All @@ -508,7 +508,7 @@ impl<T> DList<T> {
/// let mut d = DList::new();
/// assert_eq!(d.pop_front(), None);
///
/// d.push_front(1is);
/// d.push_front(1);
/// d.push_front(3);
/// assert_eq!(d.pop_front(), Some(3));
/// assert_eq!(d.pop_front(), Some(1));
Expand Down Expand Up @@ -568,7 +568,7 @@ impl<T> DList<T> {
///
/// let mut d = DList::new();
///
/// d.push_front(1is);
/// d.push_front(1);
/// d.push_front(2);
/// d.push_front(3);
///
Expand Down
8 changes: 4 additions & 4 deletions src/libcoretest/hash/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,13 @@ fn test_writer_hasher() {
assert_eq!(hash(&5u16), 5);
assert_eq!(hash(&5u32), 5);
assert_eq!(hash(&5u64), 5);
assert_eq!(hash(&5u), 5);
assert_eq!(hash(&5us), 5);

assert_eq!(hash(&5i8), 5);
assert_eq!(hash(&5i16), 5);
assert_eq!(hash(&5i32), 5);
assert_eq!(hash(&5i64), 5);
assert_eq!(hash(&5), 5);
assert_eq!(hash(&5is), 5);

assert_eq!(hash(&false), 0);
assert_eq!(hash(&true), 1);
Expand All @@ -76,12 +76,12 @@ fn test_writer_hasher() {
// FIXME (#18248) Add tests for hashing Rc<str> and Rc<[T]>

unsafe {
let ptr: *const i32 = mem::transmute(5is);
let ptr: *const i32 = mem::transmute(5us);
assert_eq!(hash(&ptr), 5);
}

unsafe {
let ptr: *mut i32 = mem::transmute(5is);
let ptr: *mut i32 = mem::transmute(5us);
assert_eq!(hash(&ptr), 5);
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/libcoretest/iter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,7 @@ fn test_iterator_size_hint() {
assert_eq!(c.clone().enumerate().size_hint(), (uint::MAX, None));
assert_eq!(c.clone().chain(vi.clone().map(|&i| i)).size_hint(), (uint::MAX, None));
assert_eq!(c.clone().zip(vi.clone()).size_hint(), (10, Some(10)));
assert_eq!(c.clone().scan(0i, |_,_| Some(0)).size_hint(), (0, None));
assert_eq!(c.clone().scan(0, |_,_| Some(0)).size_hint(), (0, None));
assert_eq!(c.clone().filter(|_| false).size_hint(), (0, None));
assert_eq!(c.clone().map(|_| 0).size_hint(), (uint::MAX, None));
assert_eq!(c.filter_map(|_| Some(0)).size_hint(), (0, None));
Expand All @@ -389,7 +389,7 @@ fn test_iterator_size_hint() {
assert_eq!(vi.clone().enumerate().size_hint(), (10, Some(10)));
assert_eq!(vi.clone().chain(v2.iter()).size_hint(), (13, Some(13)));
assert_eq!(vi.clone().zip(v2.iter()).size_hint(), (3, Some(3)));
assert_eq!(vi.clone().scan(0i, |_,_| Some(0)).size_hint(), (0, Some(10)));
assert_eq!(vi.clone().scan(0, |_,_| Some(0)).size_hint(), (0, Some(10)));
assert_eq!(vi.clone().filter(|_| false).size_hint(), (0, Some(10)));
assert_eq!(vi.clone().map(|&i| i+1).size_hint(), (10, Some(10)));
assert_eq!(vi.filter_map(|_| Some(0)).size_hint(), (0, Some(10)));
Expand Down
2 changes: 1 addition & 1 deletion src/libcoretest/option.rs
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ fn test_ord() {
/* FIXME(#20575)
#[test]
fn test_collect() {
let v: Option<Vec<int>> = (0..0).map(|_| Some(0i)).collect();
let v: Option<Vec<int>> = (0..0).map(|_| Some(0)).collect();
assert!(v == Some(vec![]));

let v: Option<Vec<int>> = (0..3).map(|x| Some(x)).collect();
Expand Down
4 changes: 2 additions & 2 deletions src/libstd/collections/hash/set.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1198,7 +1198,7 @@ mod test_set {

#[test]
fn test_drain() {
let mut s: HashSet<int> = (1is..100).collect();
let mut s: HashSet<i32> = (1..100).collect();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not critical at all, but this explicit i32 could probably be left out in cases like this and instead just _ could be used.


// try this a bunch of times to make sure we don't screw up internal state.
for _ in 0..20 {
Expand All @@ -1217,7 +1217,7 @@ mod test_set {
for _ in s.iter() { panic!("s should be empty!"); }

// reset to try again.
s.extend(1is..100);
s.extend(1..100);
}
}
}
2 changes: 1 addition & 1 deletion src/libstd/old_io/fs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1101,7 +1101,7 @@ mod test {
let dir = &tmpdir.join("di_readdir");
check!(mkdir(dir, old_io::USER_RWX));
let prefix = "foo";
for n in 0is..3 {
for n in 0..3 {
let f = dir.join(format!("{}.txt", n));
let mut w = check!(File::create(&f));
let msg_str = format!("{}{}", prefix, n);
Expand Down
6 changes: 3 additions & 3 deletions src/libstd/old_io/net/tcp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1160,7 +1160,7 @@ mod test {
tx.send(TcpStream::connect(addr).unwrap()).unwrap();
});
let _l = rx.recv().unwrap();
for i in 0is..1001 {
for i in 0i32..1001 {
match a.accept() {
Ok(..) => break,
Err(ref e) if e.kind == TimedOut => {}
Expand Down Expand Up @@ -1260,7 +1260,7 @@ mod test {
assert_eq!(s.read(&mut [0]).err().unwrap().kind, TimedOut);

s.set_timeout(Some(20));
for i in 0is..1001 {
for i in 0i32..1001 {
match s.write(&[0; 128 * 1024]) {
Ok(()) | Err(IoError { kind: ShortWrite(..), .. }) => {},
Err(IoError { kind: TimedOut, .. }) => break,
Expand Down Expand Up @@ -1318,7 +1318,7 @@ mod test {

let mut s = a.accept().unwrap();
s.set_write_timeout(Some(20));
for i in 0is..1001 {
for i in 0i32..1001 {
match s.write(&[0; 128 * 1024]) {
Ok(()) | Err(IoError { kind: ShortWrite(..), .. }) => {},
Err(IoError { kind: TimedOut, .. }) => break,
Expand Down
2 changes: 1 addition & 1 deletion src/libsyntax/parse/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -573,7 +573,7 @@ pub fn byte_lit(lit: &str) -> (u8, usize) {
if lit.len() == 1 {
(lit.as_bytes()[0], 1)
} else {
assert!(lit.as_bytes()[0] == b'\\', err(0is));
assert!(lit.as_bytes()[0] == b'\\', err(0));
let b = match lit.as_bytes()[1] {
b'"' => b'"',
b'n' => b'\n',
Expand Down
2 changes: 1 addition & 1 deletion src/libsyntax/print/pp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ pub fn mk_printer(out: Box<old_io::Writer+'static>, linewidth: usize) -> Printer
let n: usize = 3 * linewidth;
debug!("mk_printer {}", linewidth);
let token: Vec<Token> = repeat(Token::Eof).take(n).collect();
let size: Vec<isize> = repeat(0is).take(n).collect();
let size: Vec<isize> = repeat(0).take(n).collect();
let scan_stack: Vec<usize> = repeat(0us).take(n).collect();
Printer {
out: out,
Expand Down
Loading