Skip to content

Commit 0a44005

Browse files
committed
---
yaml --- r: 155579 b: refs/heads/try2 c: 49fcb27 h: refs/heads/master i: 155577: 13126d7 155575: f846586 v: v3
1 parent 5dcd44e commit 0a44005

File tree

118 files changed

+1194
-701
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

118 files changed

+1194
-701
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ refs/heads/snap-stage3: 78a7676898d9f80ab540c6df5d4c9ce35bb50463
55
refs/heads/try: 519addf6277dbafccbb4159db4b710c37eaa2ec5
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
8-
refs/heads/try2: 5f4c2800fcf0556b351857867e5b527af77149ee
8+
refs/heads/try2: 49fcb27df63b845c42d4883c47d2cfc512edeb78
99
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try2/src/compiletest/runtest.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1512,7 +1512,7 @@ fn _arm_exec_compiled_test(config: &Config,
15121512
for c in exitcode_out.as_slice().chars() {
15131513
if !c.is_digit() { break; }
15141514
exitcode = exitcode * 10 + match c {
1515-
'0' .. '9' => c as int - ('0' as int),
1515+
'0' ... '9' => c as int - ('0' as int),
15161516
_ => 101,
15171517
}
15181518
}

branches/try2/src/doc/guide.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3757,27 +3757,27 @@ match x {
37573757
}
37583758
```
37593759

3760-
You can match a range of values with `..`:
3760+
You can match a range of values with `...`:
37613761

37623762
```{rust}
37633763
let x = 1i;
37643764
37653765
match x {
3766-
1 .. 5 => println!("one through five"),
3766+
1 ... 5 => println!("one through five"),
37673767
_ => println!("anything"),
37683768
}
37693769
```
37703770

37713771
Ranges are mostly used with integers and single characters.
37723772

3773-
If you're matching multiple things, via a `|` or a `..`, you can bind
3773+
If you're matching multiple things, via a `|` or a `...`, you can bind
37743774
the value to a name with `@`:
37753775

37763776
```{rust}
37773777
let x = 1i;
37783778
37793779
match x {
3780-
x @ 1 .. 5 => println!("got {}", x),
3780+
x @ 1 ... 5 => println!("got {}", x),
37813781
_ => println!("anything"),
37823782
}
37833783
```

branches/try2/src/doc/reference.md

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2441,6 +2441,8 @@ The currently implemented features of the reference compiler are:
24412441
* `default_type_params` - Allows use of default type parameters. The future of
24422442
this feature is uncertain.
24432443

2444+
* `if_let` - Allows use of the `if let` syntax.
2445+
24442446
* `intrinsics` - Allows use of the "rust-intrinsics" ABI. Compiler intrinsics
24452447
are inherently unstable and no promise about them is made.
24462448

@@ -3229,7 +3231,7 @@ for i in range(0u, 256) {
32293231
if_expr : "if" no_struct_literal_expr '{' block '}'
32303232
else_tail ? ;
32313233
3232-
else_tail : "else" [ if_expr
3234+
else_tail : "else" [ if_expr | if_let_expr
32333235
| '{' block '}' ] ;
32343236
```
32353237

@@ -3408,7 +3410,7 @@ may be specified with `..`. For example:
34083410
34093411
let message = match x {
34103412
0 | 1 => "not many",
3411-
2 .. 9 => "a few",
3413+
2 ... 9 => "a few",
34123414
_ => "lots"
34133415
};
34143416
```
@@ -3434,6 +3436,19 @@ let message = match maybe_digit {
34343436
};
34353437
```
34363438

3439+
### If let expressions
3440+
3441+
```{.ebnf .gram}
3442+
if_let_expr : "if" "let" pat '=' expr '{' block '}'
3443+
else_tail ? ;
3444+
else_tail : "else" [ if_expr | if_let_expr | '{' block '}' ] ;
3445+
```
3446+
3447+
An `if let` expression is semantically identical to an `if` expression but in place
3448+
of a condition expression it expects a refutable let statement. If the value of the
3449+
expression on the right hand side of the let statement matches the pattern, the corresponding
3450+
block will execute, otherwise flow proceeds to the first `else` block that follows.
3451+
34373452
### Return expressions
34383453

34393454
```{.ebnf .gram}

branches/try2/src/etc/mklldeps.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ def run(args):
6767
"target_os = \"" + os + "\"",
6868
]
6969

70-
f.write("#[cfg(" + ', '.join(cfg) + ")]\n")
70+
f.write("#[cfg(all(" + ', '.join(cfg) + "))]\n")
7171

7272
version = run([llconfig, '--version']).strip()
7373

branches/try2/src/liballoc/heap.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -111,12 +111,12 @@ unsafe fn exchange_free(ptr: *mut u8, size: uint, align: uint) {
111111
// The minimum alignment guaranteed by the architecture. This value is used to
112112
// add fast paths for low alignment values. In practice, the alignment is a
113113
// constant at the call site and the branch will be optimized out.
114-
#[cfg(target_arch = "arm")]
115-
#[cfg(target_arch = "mips")]
116-
#[cfg(target_arch = "mipsel")]
114+
#[cfg(any(target_arch = "arm",
115+
target_arch = "mips",
116+
target_arch = "mipsel"))]
117117
static MIN_ALIGN: uint = 8;
118-
#[cfg(target_arch = "x86")]
119-
#[cfg(target_arch = "x86_64")]
118+
#[cfg(any(target_arch = "x86",
119+
target_arch = "x86_64"))]
120120
static MIN_ALIGN: uint = 16;
121121

122122
#[cfg(jemalloc)]
@@ -146,7 +146,7 @@ mod imp {
146146
}
147147

148148
// -lpthread needs to occur after -ljemalloc, the earlier argument isn't enough
149-
#[cfg(not(windows), not(target_os = "android"))]
149+
#[cfg(all(not(windows), not(target_os = "android")))]
150150
#[link(name = "pthread")]
151151
extern {}
152152

@@ -206,7 +206,7 @@ mod imp {
206206
}
207207
}
208208

209-
#[cfg(not(jemalloc), unix)]
209+
#[cfg(all(not(jemalloc), unix))]
210210
mod imp {
211211
use core::cmp;
212212
use core::ptr;
@@ -268,7 +268,7 @@ mod imp {
268268
pub fn stats_print() {}
269269
}
270270

271-
#[cfg(not(jemalloc), windows)]
271+
#[cfg(all(not(jemalloc), windows))]
272272
mod imp {
273273
use libc::{c_void, size_t};
274274
use libc;

branches/try2/src/libcollections/string.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -199,10 +199,10 @@ impl String {
199199
}
200200
3 => {
201201
match (byte, safe_get(v, i, total)) {
202-
(0xE0 , 0xA0 .. 0xBF) => (),
203-
(0xE1 .. 0xEC, 0x80 .. 0xBF) => (),
204-
(0xED , 0x80 .. 0x9F) => (),
205-
(0xEE .. 0xEF, 0x80 .. 0xBF) => (),
202+
(0xE0 , 0xA0 ... 0xBF) => (),
203+
(0xE1 ... 0xEC, 0x80 ... 0xBF) => (),
204+
(0xED , 0x80 ... 0x9F) => (),
205+
(0xEE ... 0xEF, 0x80 ... 0xBF) => (),
206206
_ => {
207207
error!();
208208
continue;
@@ -217,9 +217,9 @@ impl String {
217217
}
218218
4 => {
219219
match (byte, safe_get(v, i, total)) {
220-
(0xF0 , 0x90 .. 0xBF) => (),
221-
(0xF1 .. 0xF3, 0x80 .. 0xBF) => (),
222-
(0xF4 , 0x80 .. 0x8F) => (),
220+
(0xF0 , 0x90 ... 0xBF) => (),
221+
(0xF1 ... 0xF3, 0x80 ... 0xBF) => (),
222+
(0xF4 , 0x80 ... 0x8F) => (),
223223
_ => {
224224
error!();
225225
continue;

branches/try2/src/libcore/any.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ pub enum Void { }
9191
/// Every type with no non-`'static` references implements `Any`, so `Any` can
9292
/// be used as a trait object to emulate the effects dynamic typing.
9393
#[stable]
94-
pub trait Any: AnyPrivate {}
94+
pub trait Any: AnyPrivate + 'static {}
9595

9696
/// An inner trait to ensure that only this module can call `get_type_id()`.
9797
pub trait AnyPrivate {
@@ -132,7 +132,7 @@ pub trait AnyRefExt<'a> {
132132
}
133133

134134
#[stable]
135-
impl<'a> AnyRefExt<'a> for &'a Any+'a {
135+
impl<'a> AnyRefExt<'a> for &'a Any {
136136
#[inline]
137137
#[stable]
138138
fn is<T: 'static>(self) -> bool {
@@ -181,7 +181,7 @@ pub trait AnyMutRefExt<'a> {
181181
}
182182

183183
#[stable]
184-
impl<'a> AnyMutRefExt<'a> for &'a mut Any+'a {
184+
impl<'a> AnyMutRefExt<'a> for &'a mut Any {
185185
#[inline]
186186
#[unstable = "naming conventions around acquiring references may change"]
187187
fn downcast_mut<T: 'static>(self) -> Option<&'a mut T> {

branches/try2/src/libcore/char.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -123,9 +123,9 @@ pub fn to_digit(c: char, radix: uint) -> Option<uint> {
123123
fail!("to_digit: radix is too high (maximum 36)");
124124
}
125125
let val = match c {
126-
'0' .. '9' => c as uint - ('0' as uint),
127-
'a' .. 'z' => c as uint + 10u - ('a' as uint),
128-
'A' .. 'Z' => c as uint + 10u - ('A' as uint),
126+
'0' ... '9' => c as uint - ('0' as uint),
127+
'a' ... 'z' => c as uint + 10u - ('a' as uint),
128+
'A' ... 'Z' => c as uint + 10u - ('A' as uint),
129129
_ => return None,
130130
};
131131
if val < radix { Some(val) }
@@ -184,7 +184,7 @@ pub fn escape_unicode(c: char, f: |char|) {
184184
let offset = offset as uint;
185185
unsafe {
186186
match ((c as i32) >> offset) & 0xf {
187-
i @ 0 .. 9 => { f(transmute('0' as i32 + i)); }
187+
i @ 0 ... 9 => { f(transmute('0' as i32 + i)); }
188188
i => { f(transmute('a' as i32 + (i - 10))); }
189189
}
190190
}
@@ -211,7 +211,7 @@ pub fn escape_default(c: char, f: |char|) {
211211
'\\' => { f('\\'); f('\\'); }
212212
'\'' => { f('\\'); f('\''); }
213213
'"' => { f('\\'); f('"'); }
214-
'\x20' .. '\x7e' => { f(c); }
214+
'\x20' ... '\x7e' => { f(c); }
215215
_ => c.escape_unicode(f),
216216
}
217217
}

branches/try2/src/libcore/fmt/num.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -99,13 +99,13 @@ macro_rules! radix {
9999
}
100100
}
101101

102-
radix!(Binary, 2, "0b", x @ 0 .. 2 => b'0' + x)
103-
radix!(Octal, 8, "0o", x @ 0 .. 7 => b'0' + x)
104-
radix!(Decimal, 10, "", x @ 0 .. 9 => b'0' + x)
105-
radix!(LowerHex, 16, "0x", x @ 0 .. 9 => b'0' + x,
106-
x @ 10 ..15 => b'a' + (x - 10))
107-
radix!(UpperHex, 16, "0x", x @ 0 .. 9 => b'0' + x,
108-
x @ 10 ..15 => b'A' + (x - 10))
102+
radix!(Binary, 2, "0b", x @ 0 ... 2 => b'0' + x)
103+
radix!(Octal, 8, "0o", x @ 0 ... 7 => b'0' + x)
104+
radix!(Decimal, 10, "", x @ 0 ... 9 => b'0' + x)
105+
radix!(LowerHex, 16, "0x", x @ 0 ... 9 => b'0' + x,
106+
x @ 10 ... 15 => b'a' + (x - 10))
107+
radix!(UpperHex, 16, "0x", x @ 0 ... 9 => b'0' + x,
108+
x @ 10 ... 15 => b'A' + (x - 10))
109109

110110
/// A radix with in the range of `2..36`.
111111
#[deriving(Clone, PartialEq)]
@@ -124,7 +124,7 @@ impl GenericRadix for Radix {
124124
fn base(&self) -> u8 { self.base }
125125
fn digit(&self, x: u8) -> u8 {
126126
match x {
127-
x @ 0 ..9 => b'0' + x,
127+
x @ 0 ... 9 => b'0' + x,
128128
x if x < self.base() => b'a' + (x - 10),
129129
x => fail!("number not in the range 0..{}: {}", self.base() - 1, x),
130130
}

branches/try2/src/libcore/str.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -843,18 +843,18 @@ fn run_utf8_validation_iterator(iter: &mut slice::Items<u8>) -> bool {
843843
2 => if second & !CONT_MASK != TAG_CONT_U8 {err!()},
844844
3 => {
845845
match (first, second, next!() & !CONT_MASK) {
846-
(0xE0 , 0xA0 .. 0xBF, TAG_CONT_U8) |
847-
(0xE1 .. 0xEC, 0x80 .. 0xBF, TAG_CONT_U8) |
848-
(0xED , 0x80 .. 0x9F, TAG_CONT_U8) |
849-
(0xEE .. 0xEF, 0x80 .. 0xBF, TAG_CONT_U8) => {}
846+
(0xE0 , 0xA0 ... 0xBF, TAG_CONT_U8) |
847+
(0xE1 ... 0xEC, 0x80 ... 0xBF, TAG_CONT_U8) |
848+
(0xED , 0x80 ... 0x9F, TAG_CONT_U8) |
849+
(0xEE ... 0xEF, 0x80 ... 0xBF, TAG_CONT_U8) => {}
850850
_ => err!()
851851
}
852852
}
853853
4 => {
854854
match (first, second, next!() & !CONT_MASK, next!() & !CONT_MASK) {
855-
(0xF0 , 0x90 .. 0xBF, TAG_CONT_U8, TAG_CONT_U8) |
856-
(0xF1 .. 0xF3, 0x80 .. 0xBF, TAG_CONT_U8, TAG_CONT_U8) |
857-
(0xF4 , 0x80 .. 0x8F, TAG_CONT_U8, TAG_CONT_U8) => {}
855+
(0xF0 , 0x90 ... 0xBF, TAG_CONT_U8, TAG_CONT_U8) |
856+
(0xF1 ... 0xF3, 0x80 ... 0xBF, TAG_CONT_U8, TAG_CONT_U8) |
857+
(0xF4 , 0x80 ... 0x8F, TAG_CONT_U8, TAG_CONT_U8) => {}
858858
_ => err!()
859859
}
860860
}

branches/try2/src/libdebug/repr.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ impl<'a> ReprVisitor<'a> {
227227
self.writer.write("\"".as_bytes())
228228
}
229229
}
230-
'\x20'..'\x7e' => self.writer.write([ch as u8]),
230+
'\x20'...'\x7e' => self.writer.write([ch as u8]),
231231
_ => {
232232
char::escape_unicode(ch, |c| {
233233
let _ = self.writer.write([c as u8]);

branches/try2/src/libgreen/basic.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ impl EventLoop for BasicLoop {
116116
}
117117

118118
unsafe {
119-
let mut messages = self.messages.lock();
119+
let messages = self.messages.lock();
120120
// We block here if we have no messages to process and we may
121121
// receive a message at a later date
122122
if self.remotes.len() > 0 && messages.len() == 0 &&

branches/try2/src/libgreen/context.rs

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -188,27 +188,27 @@ fn initialize_call_frame(regs: &mut Registers, fptr: InitFn, arg: uint,
188188

189189
// windows requires saving more registers (both general and XMM), so the windows
190190
// register context must be larger.
191-
#[cfg(windows, target_arch = "x86_64")]
191+
#[cfg(all(windows, target_arch = "x86_64"))]
192192
#[repr(C)]
193193
struct Registers {
194194
gpr:[libc::uintptr_t, ..14],
195195
_xmm:[simd::u32x4, ..10]
196196
}
197-
#[cfg(not(windows), target_arch = "x86_64")]
197+
#[cfg(all(not(windows), target_arch = "x86_64"))]
198198
#[repr(C)]
199199
struct Registers {
200200
gpr:[libc::uintptr_t, ..10],
201201
_xmm:[simd::u32x4, ..6]
202202
}
203203

204-
#[cfg(windows, target_arch = "x86_64")]
204+
#[cfg(all(windows, target_arch = "x86_64"))]
205205
fn new_regs() -> Box<Registers> {
206206
box() Registers {
207207
gpr:[0,..14],
208208
_xmm:[simd::u32x4(0,0,0,0),..10]
209209
}
210210
}
211-
#[cfg(not(windows), target_arch = "x86_64")]
211+
#[cfg(all(not(windows), target_arch = "x86_64"))]
212212
fn new_regs() -> Box<Registers> {
213213
box() Registers {
214214
gpr:[0,..10],
@@ -288,16 +288,13 @@ fn initialize_call_frame(regs: &mut Registers, fptr: InitFn, arg: uint,
288288
regs[14] = rust_bootstrap_green_task as libc::uintptr_t; // #56 pc, r14 --> lr
289289
}
290290

291-
#[cfg(target_arch = "mips")]
292-
#[cfg(target_arch = "mipsel")]
291+
#[cfg(any(target_arch = "mips", target_arch = "mipsel"))]
293292
type Registers = [libc::uintptr_t, ..32];
294293

295-
#[cfg(target_arch = "mips")]
296-
#[cfg(target_arch = "mipsel")]
294+
#[cfg(any(target_arch = "mips", target_arch = "mipsel"))]
297295
fn new_regs() -> Box<Registers> { box {[0, .. 32]} }
298296

299-
#[cfg(target_arch = "mips")]
300-
#[cfg(target_arch = "mipsel")]
297+
#[cfg(any(target_arch = "mips", target_arch = "mipsel"))]
301298
fn initialize_call_frame(regs: &mut Registers, fptr: InitFn, arg: uint,
302299
procedure: raw::Procedure, sp: *mut uint) {
303300
let sp = align_down(sp);

branches/try2/src/libgreen/stack.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,10 @@ pub struct Stack {
2828
//
2929
// DragonFly BSD also seems to suffer from the same problem. When MAP_STACK is
3030
// used, it returns the same `ptr` multiple times.
31-
#[cfg(not(windows), not(target_os = "freebsd"), not(target_os = "dragonfly"))]
31+
#[cfg(not(any(windows, target_os = "freebsd", target_os = "dragonfly")))]
3232
static STACK_FLAGS: libc::c_int = libc::MAP_STACK | libc::MAP_PRIVATE |
3333
libc::MAP_ANON;
34-
#[cfg(target_os = "freebsd")]
35-
#[cfg(target_os = "dragonfly")]
34+
#[cfg(any(target_os = "freebsd", target_os = "dragonfly"))]
3635
static STACK_FLAGS: libc::c_int = libc::MAP_PRIVATE | libc::MAP_ANON;
3736
#[cfg(windows)]
3837
static STACK_FLAGS: libc::c_int = 0;

0 commit comments

Comments
 (0)