Skip to content

Commit 67e4fbe

Browse files
author
Alfie John
committed
---
yaml --- r: 174452 b: refs/heads/batch c: 66003c0 h: refs/heads/master v: v3
1 parent 659cf2e commit 67e4fbe

File tree

9 files changed

+60
-76
lines changed

9 files changed

+60
-76
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ refs/tags/0.12.0: f0c419429ef30723ceaf6b42f9b5a2aeb5d2e2d1
2929
refs/heads/issue-18208-method-dispatch-2: 9e1eae4fb9b6527315b4441cf8a0f5ca911d1671
3030
refs/heads/automation-fail: 1bf06495443584539b958873e04cc2f864ab10e4
3131
refs/heads/issue-18208-method-dispatch-3-quick-reject: 2009f85b9f99dedcec4404418eda9ddba90258a2
32-
refs/heads/batch: 61eb6b452d1e6b7876334cde730fd4bc7df9e9eb
32+
refs/heads/batch: 66003c06a19836f049996a629e8db4b6a118d5fa
3333
refs/heads/building: 126db549b038c84269a1e4fe46f051b2c15d6970
3434
refs/heads/beta: 44a287e6eb22ec3c2a687fc156813577464017f7
3535
refs/heads/windistfix: 7608dbad651f02e837ed05eef3d74a6662a6e928

branches/batch/src/doc/reference.md

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -257,18 +257,18 @@ cases mentioned in [Number literals](#number-literals) below.
257257

258258
| [Number literals](#number-literals)`*` | Example | Exponentiation | Suffixes |
259259
|----------------------------------------|---------|----------------|----------|
260-
| Decimal integer | `98_222i` | `N/A` | Integer suffixes |
261-
| Hex integer | `0xffi` | `N/A` | Integer suffixes |
262-
| Octal integer | `0o77i` | `N/A` | Integer suffixes |
263-
| Binary integer | `0b1111_0000i` | `N/A` | Integer suffixes |
260+
| Decimal integer | `98_222is` | `N/A` | Integer suffixes |
261+
| Hex integer | `0xffis` | `N/A` | Integer suffixes |
262+
| Octal integer | `0o77is` | `N/A` | Integer suffixes |
263+
| Binary integer | `0b1111_0000is` | `N/A` | Integer suffixes |
264264
| Floating-point | `123.0E+77f64` | `Optional` | Floating-point suffixes |
265265

266266
`*` All number literals allow `_` as a visual separator: `1_234.0E+18f64`
267267

268268
##### Suffixes
269269
| Integer | Floating-point |
270270
|---------|----------------|
271-
| `i` (`int`), `u` (`uint`), `u8`, `i8`, `u16`, `i16`, `u32`, `i32`, `u64`, `i64` | `f32`, `f64` |
271+
| `is` (`isize`), `us` (`usize`), `u8`, `i8`, `u16`, `i16`, `u32`, `i32`, `u64`, `i64` | `f32`, `f64` |
272272

273273
#### Character and string literals
274274

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

471-
* The `i` and `u` suffixes give the literal type `int` or `uint`,
471+
* The `is` and `us` suffixes give the literal type `isize` or `usize`,
472472
respectively.
473473
* Each of the signed and unsigned machine types `u8`, `i8`,
474474
`u16`, `i16`, `u32`, `i32`, `u64` and `i64`
@@ -483,9 +483,9 @@ context overconstrains the type, it is also considered a static type error.
483483
Examples of integer literals of various forms:
484484

485485
```
486-
123i; // type int
487-
123u; // type uint
488-
123_u; // type uint
486+
123is; // type isize
487+
123us; // type usize
488+
123_us // type usize
489489
0xff_u8; // type u8
490490
0o70_i16; // type i16
491491
0b1111_1111_1001_0000_i32; // type i32
@@ -1002,11 +1002,11 @@ use std::option::Option::{Some, None};
10021002
use std::collections::hash_map::{mod, HashMap};
10031003
10041004
fn foo<T>(_: T){}
1005-
fn bar(map1: HashMap<String, uint>, map2: hash_map::HashMap<String, uint>){}
1005+
fn bar(map1: HashMap<String, usize>, map2: hash_map::HashMap<String, usize>){}
10061006
10071007
fn main() {
1008-
// Equivalent to 'std::iter::range_step(0u, 10u, 2u);'
1009-
range_step(0u, 10u, 2u);
1008+
// Equivalent to 'std::iter::range_step(0us, 10, 2);'
1009+
range_step(0us, 10, 2);
10101010
10111011
// Equivalent to 'foo(vec![std::option::Option::Some(1.0f64),
10121012
// std::option::Option::None]);'
@@ -1611,7 +1611,7 @@ trait is in scope) to pointers to the trait name, used as a type.
16111611
```
16121612
# trait Shape { }
16131613
# impl Shape for int { }
1614-
# let mycircle = 0i;
1614+
# let mycircle = 0is;
16151615
let myshape: Box<Shape> = Box::new(mycircle) as Box<Shape>;
16161616
```
16171617

@@ -2821,7 +2821,7 @@ parentheses. They are used to create [tuple-typed](#tuple-types) values.
28212821
```{.tuple}
28222822
(0,);
28232823
(0.0, 4.5);
2824-
("a", 4u, true);
2824+
("a", 4us, true);
28252825
```
28262826

28272827
### Unit expressions
@@ -2958,9 +2958,9 @@ constant expression that can be evaluated at compile time, such as a
29582958
[literal](#literals) or a [static item](#static-items).
29592959

29602960
```
2961-
[1i, 2, 3, 4];
2961+
[1is, 2, 3, 4];
29622962
["a", "b", "c", "d"];
2963-
[0i; 128]; // array with 128 zeros
2963+
[0is; 128]; // array with 128 zeros
29642964
[0u8, 0u8, 0u8, 0u8];
29652965
```
29662966

@@ -3133,7 +3133,7 @@ moves](#moved-and-copied-types) its right-hand operand to its left-hand
31333133
operand.
31343134

31353135
```
3136-
# let mut x = 0i;
3136+
# let mut x = 0is;
31373137
# let y = 0;
31383138
31393139
x = y;
@@ -3270,7 +3270,7 @@ conditional expression evaluates to `false`, the `while` expression completes.
32703270
An example:
32713271

32723272
```
3273-
let mut i = 0u;
3273+
let mut i = 0us;
32743274
32753275
while i < 10 {
32763276
println!("hello");
@@ -3349,8 +3349,8 @@ for e in v.iter() {
33493349
An example of a for loop over a series of integers:
33503350

33513351
```
3352-
# fn bar(b:uint) { }
3353-
for i in range(0u, 256) {
3352+
# fn bar(b:usize) { }
3353+
for i in range(0us, 256) {
33543354
bar(i);
33553355
}
33563356
```
@@ -3520,11 +3520,11 @@ fn main() {
35203520
```
35213521

35223522
Patterns can also dereference pointers by using the `&`, `&mut` and `box`
3523-
symbols, as appropriate. For example, these two matches on `x: &int` are
3523+
symbols, as appropriate. For example, these two matches on `x: &isize` are
35243524
equivalent:
35253525

35263526
```
3527-
# let x = &3i;
3527+
# let x = &3is;
35283528
let y = match *x { 0 => "zero", _ => "some" };
35293529
let z = match x { &0 => "zero", _ => "some" };
35303530
@@ -3545,7 +3545,7 @@ Multiple match patterns may be joined with the `|` operator. A range of values
35453545
may be specified with `...`. For example:
35463546

35473547
```
3548-
# let x = 2i;
3548+
# let x = 2is;
35493549
35503550
let message = match x {
35513551
0 | 1 => "not many",
@@ -3886,16 +3886,16 @@ The type of a closure mapping an input of type `A` to an output of type `B` is
38863886
An example of creating and calling a closure:
38873887

38883888
```rust
3889-
let captured_var = 10i;
3889+
let captured_var = 10is;
38903890

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

3893-
let closure_args = |&: arg: int| -> int {
3893+
let closure_args = |&: arg: isize| -> isize {
38943894
println!("captured_var={}, arg={}", captured_var, arg);
38953895
arg // Note lack of semicolon after 'arg'
38963896
};
38973897

3898-
fn call_closure<F: Fn(), G: Fn(int) -> int>(c1: F, c2: G) {
3898+
fn call_closure<F: Fn(), G: Fn(isize) -> isize>(c1: F, c2: G) {
38993899
c1();
39003900
c2(2);
39013901
}
@@ -3927,7 +3927,7 @@ trait Printable {
39273927
fn stringify(&self) -> String;
39283928
}
39293929
3930-
impl Printable for int {
3930+
impl Printable for isize {
39313931
fn stringify(&self) -> String { self.to_string() }
39323932
}
39333933
@@ -3936,7 +3936,7 @@ fn print(a: Box<Printable>) {
39363936
}
39373937
39383938
fn main() {
3939-
print(Box::new(10i) as Box<Printable>);
3939+
print(Box::new(10is) as Box<Printable>);
39403940
}
39413941
```
39423942

branches/batch/src/etc/nano/rust.nanorc

Lines changed: 0 additions & 35 deletions
This file was deleted.

branches/batch/src/libserialize/json.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
//!
3535
//! An object is a series of string keys mapping to values, in `"key": value` format.
3636
//! Arrays are enclosed in square brackets ([ ... ]) and objects in curly brackets ({ ... }).
37-
//! A simple JSON document encoding a person, their age, address and phone numbers could look like
37+
//! A simple JSON document encoding a person, his/her age, address and phone numbers could look like
3838
//!
3939
//! ```ignore
4040
//! {

branches/batch/src/libstd/collections/hash/map.rs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2112,6 +2112,23 @@ mod test_map {
21122112
assert_eq!(m.remove(&0), Some(0));
21132113
}
21142114

2115+
#[test]
2116+
fn test_find_equiv() {
2117+
let mut m = HashMap::new();
2118+
2119+
let (foo, bar, baz) = (1i,2i,3i);
2120+
m.insert("foo".to_string(), foo);
2121+
m.insert("bar".to_string(), bar);
2122+
m.insert("baz".to_string(), baz);
2123+
2124+
2125+
assert_eq!(m.get("foo"), Some(&foo));
2126+
assert_eq!(m.get("bar"), Some(&bar));
2127+
assert_eq!(m.get("baz"), Some(&baz));
2128+
2129+
assert_eq!(m.get("qux"), None);
2130+
}
2131+
21152132
#[test]
21162133
fn test_from_iter() {
21172134
let xs = [(1i, 1i), (2, 2), (3, 3), (4, 4), (5, 5), (6, 6)];

branches/batch/src/libsyntax/parse/mod.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -253,10 +253,9 @@ pub fn file_to_filemap(sess: &ParseSess, path: &Path, spanopt: Option<Span>)
253253
let bytes = match File::open(path).read_to_end() {
254254
Ok(bytes) => bytes,
255255
Err(e) => {
256-
let error_msg = e.desc;
257-
err(&format!("couldn't read {:?}: {}",
256+
err(&format!("couldn't read {:?}: {:?}",
258257
path.display(),
259-
error_msg)[]);
258+
e)[]);
260259
unreachable!()
261260
}
262261
};

branches/batch/src/libsyntax/parse/parser.rs

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2139,7 +2139,6 @@ impl<'a> Parser<'a> {
21392139

21402140
let ex: Expr_;
21412141

2142-
// Note: when adding new syntax here, don't forget to adjust Token::can_begin_expr().
21432142
match self.token {
21442143
token::OpenDelim(token::Paren) => {
21452144
self.bump();
@@ -2777,7 +2776,6 @@ impl<'a> Parser<'a> {
27772776
let lo = self.span.lo;
27782777
let hi;
27792778

2780-
// Note: when adding new unary operators, don't forget to adjust Token::can_begin_expr()
27812779
let ex;
27822780
match self.token {
27832781
token::Not => {
@@ -5538,6 +5536,13 @@ impl<'a> Parser<'a> {
55385536
(id, ItemEnum(enum_definition, generics), None)
55395537
}
55405538

5539+
fn fn_expr_lookahead(tok: &token::Token) -> bool {
5540+
match *tok {
5541+
token::OpenDelim(token::Paren) | token::At | token::Tilde | token::BinOp(_) => true,
5542+
_ => false
5543+
}
5544+
}
5545+
55415546
/// Parses a string as an ABI spec on an extern type or module. Consumes
55425547
/// the `extern` keyword, if one is found.
55435548
fn parse_opt_abi(&mut self) -> Option<abi::Abi> {
@@ -5710,7 +5715,8 @@ impl<'a> Parser<'a> {
57105715
maybe_append(attrs, extra_attrs));
57115716
return IoviItem(item);
57125717
}
5713-
if self.token.is_keyword(keywords::Fn) {
5718+
if self.token.is_keyword(keywords::Fn) &&
5719+
self.look_ahead(1, |f| !Parser::fn_expr_lookahead(f)) {
57145720
// FUNCTION ITEM
57155721
self.bump();
57165722
let (ident, item_, extra_attrs) =

branches/batch/src/libsyntax/parse/token.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -183,14 +183,14 @@ impl Token {
183183
Underscore => true,
184184
Tilde => true,
185185
Literal(_, _) => true,
186+
Pound => true,
187+
At => true,
186188
Not => true,
187189
BinOp(Minus) => true,
188190
BinOp(Star) => true,
189191
BinOp(And) => true,
190192
BinOp(Or) => true, // in lambda syntax
191193
OrOr => true, // in lambda syntax
192-
AndAnd => true, // double borrow
193-
DotDot => true, // range notation
194194
ModSep => true,
195195
Interpolated(NtExpr(..)) => true,
196196
Interpolated(NtIdent(..)) => true,

branches/batch/src/test/run-pass/range.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,6 @@
1212

1313
fn foo() -> int { 42 }
1414

15-
// Test that range syntax works in return statements
16-
fn return_range_to() -> ::std::ops::RangeTo<i32> { return ..1; }
17-
1815
pub fn main() {
1916
let mut count = 0;
2017
for i in 0u..10 {

0 commit comments

Comments
 (0)