Skip to content

Commit ddcc436

Browse files
committed
---
yaml --- r: 55605 b: refs/heads/master c: 939a97f h: refs/heads/master i: 55603: 559b4df v: v3
1 parent 91bad28 commit ddcc436

Some content is hidden

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

70 files changed

+920
-1761
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
refs/heads/master: 2c8278746de3df60ef9c3002f69c9511327a10f2
2+
refs/heads/master: 939a97f5cb4c8f44bc60784bbf4aa5d44f1c5dca
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 79a2b2eafc3c766cecec8a5f76317693bae9ed17
55
refs/heads/try: 8eb2bab100b42f0ba751552d8eff00eb2134c55a

trunk/.gitignore

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

trunk/doc/tutorial.md

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1669,9 +1669,6 @@ 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-
16751672
## For loops
16761673

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

trunk/mk/rt.mk

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,7 @@ 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 \
80-
rt/rust_test_helpers.cpp
79+
rt/rust_android_dummy.cpp
8180

8281
RUNTIME_CS_$(1) := rt/linenoise/linenoise.c rt/linenoise/utf8.c
8382

trunk/src/etc/x86.supp

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -654,11 +654,3 @@
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-
}

trunk/src/libcore/iterator.rs

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ 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>;
2625
fn advance(&mut self, f: &fn(A) -> bool);
2726
}
2827

@@ -43,11 +42,6 @@ impl<A, T: Iterator<A>> IteratorUtil<A> for T {
4342
FilterIterator{iter: self, predicate: predicate}
4443
}
4544

46-
#[inline(always)]
47-
fn enumerate(self) -> EnumerateIterator<T> {
48-
EnumerateIterator{iter: self, count: 0}
49-
}
50-
5145
/// A shim implementing the `for` loop iteration protocol for iterator objects
5246
#[inline]
5347
fn advance(&mut self, f: &fn(A) -> bool) {
@@ -110,22 +104,3 @@ impl<'self, A, B, T: Iterator<A>> Iterator<B> for MapIterator<'self, A, B, T> {
110104
}
111105
}
112106
}
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-
}

trunk/src/libcore/num/f32.rs

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

289289
#[cfg(notest)]
290290
impl ops::Add<f32,f32> for f32 {
291+
#[inline(always)]
291292
fn add(&self, other: &f32) -> f32 { *self + *other }
292293
}
293294
#[cfg(notest)]
294295
impl ops::Sub<f32,f32> for f32 {
296+
#[inline(always)]
295297
fn sub(&self, other: &f32) -> f32 { *self - *other }
296298
}
297299
#[cfg(notest)]
298300
impl ops::Mul<f32,f32> for f32 {
301+
#[inline(always)]
299302
fn mul(&self, other: &f32) -> f32 { *self * *other }
300303
}
301304
#[cfg(notest)]
302305
impl ops::Div<f32,f32> for f32 {
306+
#[inline(always)]
303307
fn div(&self, other: &f32) -> f32 { *self / *other }
304308
}
305309
#[cfg(notest)]
306310
impl ops::Modulo<f32,f32> for f32 {
311+
#[inline(always)]
307312
fn modulo(&self, other: &f32) -> f32 { *self % *other }
308313
}
309314
#[cfg(notest)]
310315
impl ops::Neg<f32> for f32 {
316+
#[inline(always)]
311317
fn neg(&self) -> f32 { -*self }
312318
}
313319

trunk/src/libcore/num/f64.rs

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

311311
#[cfg(notest)]
312312
impl ops::Add<f64,f64> for f64 {
313+
#[inline(always)]
313314
fn add(&self, other: &f64) -> f64 { *self + *other }
314315
}
315316
#[cfg(notest)]
316317
impl ops::Sub<f64,f64> for f64 {
318+
#[inline(always)]
317319
fn sub(&self, other: &f64) -> f64 { *self - *other }
318320
}
319321
#[cfg(notest)]
320322
impl ops::Mul<f64,f64> for f64 {
323+
#[inline(always)]
321324
fn mul(&self, other: &f64) -> f64 { *self * *other }
322325
}
323326
#[cfg(notest)]
324327
impl ops::Div<f64,f64> for f64 {
328+
#[inline(always)]
325329
fn div(&self, other: &f64) -> f64 { *self / *other }
326330
}
327331
#[cfg(notest)]
328332
impl ops::Modulo<f64,f64> for f64 {
333+
#[inline(always)]
329334
fn modulo(&self, other: &f64) -> f64 { *self % *other }
330335
}
331336
#[cfg(notest)]
332337
impl ops::Neg<f64> for f64 {
338+
#[inline(always)]
333339
fn neg(&self) -> f64 { -*self }
334340
}
335341

trunk/src/libcore/num/float.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -387,15 +387,21 @@ pub fn tan(x: float) -> float {
387387
388388
#[cfg(notest)]
389389
impl Eq for float {
390+
#[inline(always)]
390391
fn eq(&self, other: &float) -> bool { (*self) == (*other) }
392+
#[inline(always)]
391393
fn ne(&self, other: &float) -> bool { (*self) != (*other) }
392394
}
393395
394396
#[cfg(notest)]
395397
impl Ord for float {
398+
#[inline(always)]
396399
fn lt(&self, other: &float) -> bool { (*self) < (*other) }
400+
#[inline(always)]
397401
fn le(&self, other: &float) -> bool { (*self) <= (*other) }
402+
#[inline(always)]
398403
fn ge(&self, other: &float) -> bool { (*self) >= (*other) }
404+
#[inline(always)]
399405
fn gt(&self, other: &float) -> bool { (*self) > (*other) }
400406
}
401407
@@ -444,26 +450,32 @@ impl num::Round for float {
444450
445451
#[cfg(notest)]
446452
impl ops::Add<float,float> for float {
453+
#[inline(always)]
447454
fn add(&self, other: &float) -> float { *self + *other }
448455
}
449456
#[cfg(notest)]
450457
impl ops::Sub<float,float> for float {
458+
#[inline(always)]
451459
fn sub(&self, other: &float) -> float { *self - *other }
452460
}
453461
#[cfg(notest)]
454462
impl ops::Mul<float,float> for float {
463+
#[inline(always)]
455464
fn mul(&self, other: &float) -> float { *self * *other }
456465
}
457466
#[cfg(notest)]
458467
impl ops::Div<float,float> for float {
468+
#[inline(always)]
459469
fn div(&self, other: &float) -> float { *self / *other }
460470
}
461471
#[cfg(notest)]
462472
impl ops::Modulo<float,float> for float {
473+
#[inline(always)]
463474
fn modulo(&self, other: &float) -> float { *self % *other }
464475
}
465476
#[cfg(notest)]
466477
impl ops::Neg<float> for float {
478+
#[inline(always)]
467479
fn neg(&self) -> float { -*self }
468480
}
469481

trunk/src/libcore/num/int-template.rs

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,29 +177,66 @@ impl num::One for T {
177177
178178
#[cfg(notest)]
179179
impl ops::Add<T,T> for T {
180+
#[inline(always)]
180181
fn add(&self, other: &T) -> T { *self + *other }
181182
}
182183
#[cfg(notest)]
183184
impl ops::Sub<T,T> for T {
185+
#[inline(always)]
184186
fn sub(&self, other: &T) -> T { *self - *other }
185187
}
186188
#[cfg(notest)]
187189
impl ops::Mul<T,T> for T {
190+
#[inline(always)]
188191
fn mul(&self, other: &T) -> T { *self * *other }
189192
}
190193
#[cfg(notest)]
191194
impl ops::Div<T,T> for T {
195+
#[inline(always)]
192196
fn div(&self, other: &T) -> T { *self / *other }
193197
}
194198
#[cfg(notest)]
195199
impl ops::Modulo<T,T> for T {
200+
#[inline(always)]
196201
fn modulo(&self, other: &T) -> T { *self % *other }
197202
}
198203
#[cfg(notest)]
199204
impl ops::Neg<T> for T {
205+
#[inline(always)]
200206
fn neg(&self) -> T { -*self }
201207
}
202208
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+
203240
// String conversion functions and impl str -> num
204241
205242
/// Parse a string as a number in base 10.
@@ -283,6 +320,16 @@ mod tests {
283320
use super::inst::T;
284321
use prelude::*;
285322
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+
286333
#[test]
287334
fn test_from_str() {
288335
assert!(from_str(~"0") == Some(0 as T));

trunk/src/libcore/num/uint-template.rs

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,29 +142,66 @@ impl num::One for T {
142142
143143
#[cfg(notest)]
144144
impl ops::Add<T,T> for T {
145+
#[inline(always)]
145146
fn add(&self, other: &T) -> T { *self + *other }
146147
}
147148
#[cfg(notest)]
148149
impl ops::Sub<T,T> for T {
150+
#[inline(always)]
149151
fn sub(&self, other: &T) -> T { *self - *other }
150152
}
151153
#[cfg(notest)]
152154
impl ops::Mul<T,T> for T {
155+
#[inline(always)]
153156
fn mul(&self, other: &T) -> T { *self * *other }
154157
}
155158
#[cfg(notest)]
156159
impl ops::Div<T,T> for T {
160+
#[inline(always)]
157161
fn div(&self, other: &T) -> T { *self / *other }
158162
}
159163
#[cfg(notest)]
160164
impl ops::Modulo<T,T> for T {
165+
#[inline(always)]
161166
fn modulo(&self, other: &T) -> T { *self % *other }
162167
}
163168
#[cfg(notest)]
164169
impl ops::Neg<T> for T {
170+
#[inline(always)]
165171
fn neg(&self) -> T { -*self }
166172
}
167173
174+
#[cfg(notest)]
175+
impl ops::BitOr<T,T> for T {
176+
#[inline(always)]
177+
fn bitor(&self, other: &T) -> T { *self | *other }
178+
}
179+
#[cfg(notest)]
180+
impl ops::BitAnd<T,T> for T {
181+
#[inline(always)]
182+
fn bitand(&self, other: &T) -> T { *self & *other }
183+
}
184+
#[cfg(notest)]
185+
impl ops::BitXor<T,T> for T {
186+
#[inline(always)]
187+
fn bitxor(&self, other: &T) -> T { *self ^ *other }
188+
}
189+
#[cfg(notest)]
190+
impl ops::Shl<T,T> for T {
191+
#[inline(always)]
192+
fn shl(&self, other: &T) -> T { *self << *other }
193+
}
194+
#[cfg(notest)]
195+
impl ops::Shr<T,T> for T {
196+
#[inline(always)]
197+
fn shr(&self, other: &T) -> T { *self >> *other }
198+
}
199+
#[cfg(notest)]
200+
impl ops::Not<T> for T {
201+
#[inline(always)]
202+
fn not(&self) -> T { !*self }
203+
}
204+
168205
// String conversion functions and impl str -> num
169206
170207
/// Parse a string as a number in base 10.
@@ -247,6 +284,17 @@ mod tests {
247284
use super::*;
248285
use super::inst::T;
249286
use prelude::*;
287+
288+
#[test]
289+
fn test_bitwise_ops() {
290+
assert!(0b1110 as T == (0b1100 as T).bitor(&(0b1010 as T)));
291+
assert!(0b1000 as T == (0b1100 as T).bitand(&(0b1010 as T)));
292+
assert!(0b0110 as T == (0b1100 as T).bitxor(&(0b1010 as T)));
293+
assert!(0b1110 as T == (0b0111 as T).shl(&(1 as T)));
294+
assert!(0b0111 as T == (0b1110 as T).shr(&(1 as T)));
295+
assert!(max_value - (0b1011 as T) == (0b1011 as T).not());
296+
}
297+
250298
#[test]
251299
pub fn test_to_str() {
252300
assert!(to_str_radix(0 as T, 10u) == ~"0");

trunk/src/libcore/repr.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@ use io::{Writer, WriterUtil};
2323
use libc::c_void;
2424
use managed;
2525
use ptr;
26-
#[cfg(stage0)] use sys;
2726
use reflect;
2827
use reflect::{MovePtr, align};
28+
use sys;
2929
use to_str::ToStr;
3030
use vec::UnboxedVecRepr;
3131
use vec::raw::{VecRepr, SliceRepr};
@@ -479,7 +479,7 @@ impl TyVisitor for ReprVisitor {
479479
}
480480

481481
#[cfg(not(stage0))]
482-
fn visit_enter_enum(&self, _n_variants: uint,
482+
fn visit_enter_enum(&self, n_variants: uint,
483483
get_disr: extern unsafe fn(ptr: *Opaque) -> int,
484484
_sz: uint, _align: uint) -> bool {
485485
let disr = unsafe { get_disr(transmute(self.ptr)) };

0 commit comments

Comments
 (0)