Skip to content

Commit 15a8779

Browse files
committed
---
yaml --- r: 56979 b: refs/heads/try c: 19cc352 h: refs/heads/master i: 56977: a303674 56975: 1abd081 v: v3
1 parent d7fae81 commit 15a8779

Some content is hidden

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

68 files changed

+1755
-916
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
refs/heads/master: c081ffbd1e845687202a975ea2e698b623e5722f
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 79a2b2eafc3c766cecec8a5f76317693bae9ed17
5-
refs/heads/try: 939a97f5cb4c8f44bc60784bbf4aa5d44f1c5dca
5+
refs/heads/try: 19cc352302838dd379c0d4a335a093fbfd0df64b
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c

branches/try/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,3 +86,4 @@ config.stamp
8686
.DS_Store
8787
src/etc/dl
8888
.settings/
89+
build/

branches/try/doc/tutorial.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1669,6 +1669,9 @@ do spawn {
16691669
}
16701670
~~~~
16711671

1672+
If you want to see the output of `debug!` statements, you will need to turn on `debug!` logging.
1673+
To enable `debug!` logging, set the RUST_LOG environment variable to `debug` (e.g., with bash, `export RUST_LOG=debug`)
1674+
16721675
## For loops
16731676

16741677
The most common way to express iteration in Rust is with a `for`

branches/try/mk/rt.mk

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,8 @@ RUNTIME_CXXS_$(1) := \
7676
rt/boxed_region.cpp \
7777
rt/arch/$$(HOST_$(1))/context.cpp \
7878
rt/arch/$$(HOST_$(1))/gpr.cpp \
79-
rt/rust_android_dummy.cpp
79+
rt/rust_android_dummy.cpp \
80+
rt/rust_test_helpers.cpp
8081

8182
RUNTIME_CS_$(1) := rt/linenoise/linenoise.c rt/linenoise/utf8.c
8283

branches/try/src/etc/x86.supp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -654,3 +654,11 @@
654654
fun:_ZN5visit30visit_struct_dtor_helper_*
655655
...
656656
}
657+
658+
{
659+
llvm-optimization-reads-uninitialized-memory-16
660+
Memcheck:Cond
661+
fun:_ZN7ast_map6map_fn*
662+
fun:_ZN5visit30visit_struct_dtor_helper*
663+
...
664+
}

branches/try/src/libcore/io.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ pub trait ReaderUtil {
176176
fn read_bytes(&self, len: uint) -> ~[u8];
177177

178178
/**
179-
* Reads up until a specific character or EOF.
179+
* Reads up until a specific byte is seen or EOF.
180180
*
181181
* The `include` parameter specifies if the character should be included
182182
* in the returned string.
@@ -185,7 +185,7 @@ pub trait ReaderUtil {
185185
*
186186
* None right now.
187187
*/
188-
fn read_until(&self, c: char, include: bool) -> ~str;
188+
fn read_until(&self, c: u8, include: bool) -> ~str;
189189

190190
/**
191191
* Reads up until the first '\n' or EOF.
@@ -577,7 +577,7 @@ impl<T:Reader> ReaderUtil for T {
577577
bytes
578578
}
579579

580-
fn read_until(&self, c: char, include: bool) -> ~str {
580+
fn read_until(&self, c: u8, include: bool) -> ~str {
581581
let mut bytes = ~[];
582582
loop {
583583
let ch = self.read_byte();
@@ -593,7 +593,7 @@ impl<T:Reader> ReaderUtil for T {
593593
}
594594

595595
fn read_line(&self) -> ~str {
596-
self.read_until('\n', false)
596+
self.read_until('\n' as u8, false)
597597
}
598598

599599
fn read_chars(&self, n: uint) -> ~[char] {
@@ -667,7 +667,7 @@ impl<T:Reader> ReaderUtil for T {
667667
}
668668

669669
fn read_c_str(&self) -> ~str {
670-
self.read_until(0 as char, false)
670+
self.read_until(0u8, false)
671671
}
672672

673673
fn read_whole_stream(&self) -> ~[u8] {
@@ -693,7 +693,7 @@ impl<T:Reader> ReaderUtil for T {
693693
// include the \n, so that we can distinguish an entirely empty
694694
// line read after "...\n", and the trailing empty line in
695695
// "...\n\n".
696-
let mut line = self.read_until('\n', true);
696+
let mut line = self.read_until('\n' as u8, true);
697697

698698
// blank line at the end of the reader is ignored
699699
if self.eof() && line.is_empty() { break; }

branches/try/src/libcore/iterator.rs

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ pub trait IteratorUtil<A> {
2222
// FIXME: #5898: should be called map
2323
fn transform<'r, B>(self, f: &'r fn(A) -> B) -> MapIterator<'r, A, B, Self>;
2424
fn filter<'r>(self, predicate: &'r fn(&A) -> bool) -> FilterIterator<'r, A, Self>;
25+
fn enumerate(self) -> EnumerateIterator<Self>;
2526
fn advance(&mut self, f: &fn(A) -> bool);
2627
}
2728

@@ -42,6 +43,11 @@ impl<A, T: Iterator<A>> IteratorUtil<A> for T {
4243
FilterIterator{iter: self, predicate: predicate}
4344
}
4445

46+
#[inline(always)]
47+
fn enumerate(self) -> EnumerateIterator<T> {
48+
EnumerateIterator{iter: self, count: 0}
49+
}
50+
4551
/// A shim implementing the `for` loop iteration protocol for iterator objects
4652
#[inline]
4753
fn advance(&mut self, f: &fn(A) -> bool) {
@@ -104,3 +110,22 @@ impl<'self, A, B, T: Iterator<A>> Iterator<B> for MapIterator<'self, A, B, T> {
104110
}
105111
}
106112
}
113+
114+
pub struct EnumerateIterator<T> {
115+
priv iter: T,
116+
priv count: uint
117+
}
118+
119+
impl<A, T: Iterator<A>> Iterator<(uint, A)> for EnumerateIterator<T> {
120+
#[inline]
121+
fn next(&mut self) -> Option<(uint, A)> {
122+
match self.iter.next() {
123+
Some(a) => {
124+
let ret = Some((self.count, a));
125+
self.count += 1;
126+
ret
127+
}
128+
_ => None
129+
}
130+
}
131+
}

branches/try/src/libcore/num/f32.rs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -288,32 +288,26 @@ impl num::One for f32 {
288288

289289
#[cfg(notest)]
290290
impl ops::Add<f32,f32> for f32 {
291-
#[inline(always)]
292291
fn add(&self, other: &f32) -> f32 { *self + *other }
293292
}
294293
#[cfg(notest)]
295294
impl ops::Sub<f32,f32> for f32 {
296-
#[inline(always)]
297295
fn sub(&self, other: &f32) -> f32 { *self - *other }
298296
}
299297
#[cfg(notest)]
300298
impl ops::Mul<f32,f32> for f32 {
301-
#[inline(always)]
302299
fn mul(&self, other: &f32) -> f32 { *self * *other }
303300
}
304301
#[cfg(notest)]
305302
impl ops::Div<f32,f32> for f32 {
306-
#[inline(always)]
307303
fn div(&self, other: &f32) -> f32 { *self / *other }
308304
}
309305
#[cfg(notest)]
310306
impl ops::Modulo<f32,f32> for f32 {
311-
#[inline(always)]
312307
fn modulo(&self, other: &f32) -> f32 { *self % *other }
313308
}
314309
#[cfg(notest)]
315310
impl ops::Neg<f32> for f32 {
316-
#[inline(always)]
317311
fn neg(&self) -> f32 { -*self }
318312
}
319313

branches/try/src/libcore/num/f64.rs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -310,32 +310,26 @@ impl num::One for f64 {
310310

311311
#[cfg(notest)]
312312
impl ops::Add<f64,f64> for f64 {
313-
#[inline(always)]
314313
fn add(&self, other: &f64) -> f64 { *self + *other }
315314
}
316315
#[cfg(notest)]
317316
impl ops::Sub<f64,f64> for f64 {
318-
#[inline(always)]
319317
fn sub(&self, other: &f64) -> f64 { *self - *other }
320318
}
321319
#[cfg(notest)]
322320
impl ops::Mul<f64,f64> for f64 {
323-
#[inline(always)]
324321
fn mul(&self, other: &f64) -> f64 { *self * *other }
325322
}
326323
#[cfg(notest)]
327324
impl ops::Div<f64,f64> for f64 {
328-
#[inline(always)]
329325
fn div(&self, other: &f64) -> f64 { *self / *other }
330326
}
331327
#[cfg(notest)]
332328
impl ops::Modulo<f64,f64> for f64 {
333-
#[inline(always)]
334329
fn modulo(&self, other: &f64) -> f64 { *self % *other }
335330
}
336331
#[cfg(notest)]
337332
impl ops::Neg<f64> for f64 {
338-
#[inline(always)]
339333
fn neg(&self) -> f64 { -*self }
340334
}
341335

branches/try/src/libcore/num/float.rs

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -387,21 +387,15 @@ pub fn tan(x: float) -> float {
387387
388388
#[cfg(notest)]
389389
impl Eq for float {
390-
#[inline(always)]
391390
fn eq(&self, other: &float) -> bool { (*self) == (*other) }
392-
#[inline(always)]
393391
fn ne(&self, other: &float) -> bool { (*self) != (*other) }
394392
}
395393
396394
#[cfg(notest)]
397395
impl Ord for float {
398-
#[inline(always)]
399396
fn lt(&self, other: &float) -> bool { (*self) < (*other) }
400-
#[inline(always)]
401397
fn le(&self, other: &float) -> bool { (*self) <= (*other) }
402-
#[inline(always)]
403398
fn ge(&self, other: &float) -> bool { (*self) >= (*other) }
404-
#[inline(always)]
405399
fn gt(&self, other: &float) -> bool { (*self) > (*other) }
406400
}
407401
@@ -450,32 +444,26 @@ impl num::Round for float {
450444
451445
#[cfg(notest)]
452446
impl ops::Add<float,float> for float {
453-
#[inline(always)]
454447
fn add(&self, other: &float) -> float { *self + *other }
455448
}
456449
#[cfg(notest)]
457450
impl ops::Sub<float,float> for float {
458-
#[inline(always)]
459451
fn sub(&self, other: &float) -> float { *self - *other }
460452
}
461453
#[cfg(notest)]
462454
impl ops::Mul<float,float> for float {
463-
#[inline(always)]
464455
fn mul(&self, other: &float) -> float { *self * *other }
465456
}
466457
#[cfg(notest)]
467458
impl ops::Div<float,float> for float {
468-
#[inline(always)]
469459
fn div(&self, other: &float) -> float { *self / *other }
470460
}
471461
#[cfg(notest)]
472462
impl ops::Modulo<float,float> for float {
473-
#[inline(always)]
474463
fn modulo(&self, other: &float) -> float { *self % *other }
475464
}
476465
#[cfg(notest)]
477466
impl ops::Neg<float> for float {
478-
#[inline(always)]
479467
fn neg(&self) -> float { -*self }
480468
}
481469

branches/try/src/libcore/num/int-template.rs

Lines changed: 0 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -177,66 +177,29 @@ impl num::One for T {
177177
178178
#[cfg(notest)]
179179
impl ops::Add<T,T> for T {
180-
#[inline(always)]
181180
fn add(&self, other: &T) -> T { *self + *other }
182181
}
183182
#[cfg(notest)]
184183
impl ops::Sub<T,T> for T {
185-
#[inline(always)]
186184
fn sub(&self, other: &T) -> T { *self - *other }
187185
}
188186
#[cfg(notest)]
189187
impl ops::Mul<T,T> for T {
190-
#[inline(always)]
191188
fn mul(&self, other: &T) -> T { *self * *other }
192189
}
193190
#[cfg(notest)]
194191
impl ops::Div<T,T> for T {
195-
#[inline(always)]
196192
fn div(&self, other: &T) -> T { *self / *other }
197193
}
198194
#[cfg(notest)]
199195
impl ops::Modulo<T,T> for T {
200-
#[inline(always)]
201196
fn modulo(&self, other: &T) -> T { *self % *other }
202197
}
203198
#[cfg(notest)]
204199
impl ops::Neg<T> for T {
205-
#[inline(always)]
206200
fn neg(&self) -> T { -*self }
207201
}
208202
209-
#[cfg(notest)]
210-
impl ops::BitOr<T,T> for T {
211-
#[inline(always)]
212-
fn bitor(&self, other: &T) -> T { *self | *other }
213-
}
214-
#[cfg(notest)]
215-
impl ops::BitAnd<T,T> for T {
216-
#[inline(always)]
217-
fn bitand(&self, other: &T) -> T { *self & *other }
218-
}
219-
#[cfg(notest)]
220-
impl ops::BitXor<T,T> for T {
221-
#[inline(always)]
222-
fn bitxor(&self, other: &T) -> T { *self ^ *other }
223-
}
224-
#[cfg(notest)]
225-
impl ops::Shl<T,T> for T {
226-
#[inline(always)]
227-
fn shl(&self, other: &T) -> T { *self << *other }
228-
}
229-
#[cfg(notest)]
230-
impl ops::Shr<T,T> for T {
231-
#[inline(always)]
232-
fn shr(&self, other: &T) -> T { *self >> *other }
233-
}
234-
#[cfg(notest)]
235-
impl ops::Not<T> for T {
236-
#[inline(always)]
237-
fn not(&self) -> T { !*self }
238-
}
239-
240203
// String conversion functions and impl str -> num
241204
242205
/// Parse a string as a number in base 10.
@@ -320,16 +283,6 @@ mod tests {
320283
use super::inst::T;
321284
use prelude::*;
322285
323-
#[test]
324-
fn test_bitwise_ops() {
325-
assert!(0b1110 as T == (0b1100 as T).bitor(&(0b1010 as T)));
326-
assert!(0b1000 as T == (0b1100 as T).bitand(&(0b1010 as T)));
327-
assert!(0b0110 as T == (0b1100 as T).bitxor(&(0b1010 as T)));
328-
assert!(0b1110 as T == (0b0111 as T).shl(&(1 as T)));
329-
assert!(0b0111 as T == (0b1110 as T).shr(&(1 as T)));
330-
assert!(-(0b11 as T) - (1 as T) == (0b11 as T).not());
331-
}
332-
333286
#[test]
334287
fn test_from_str() {
335288
assert!(from_str(~"0") == Some(0 as T));

0 commit comments

Comments
 (0)