Skip to content

Commit 809cdc9

Browse files
committed
---
yaml --- r: 69488 b: refs/heads/auto c: f34fadd h: refs/heads/master v: v3
1 parent 230bb65 commit 809cdc9

Some content is hidden

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

123 files changed

+1963
-2269
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,6 @@ refs/heads/try3: 9387340aab40a73e8424c48fd42f0c521a4875c0
1414
refs/tags/release-0.3.1: 495bae036dfe5ec6ceafd3312b4dca48741e845b
1515
refs/tags/release-0.4: e828ea2080499553b97dfe33b3f4d472b4562ad7
1616
refs/tags/release-0.5: 7e3bcfbf21278251ee936ad53e92e9b719702d73
17-
refs/heads/auto: aa89325cb01308f48b134f199a99c6d2f4e0bfe9
17+
refs/heads/auto: f34fadd126ce9ffcd5a79c3ad5d06ad58c6fd8a8
1818
refs/heads/servo: af82457af293e2a842ba6b7759b70288da276167
1919
refs/tags/release-0.6: b4ebcfa1812664df5e142f0134a5faea3918544c

branches/auto/mk/tests.mk

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -312,26 +312,28 @@ define TEST_RUNNER
312312
# If NO_REBUILD is set then break the dependencies on extra so we can
313313
# test crates without rebuilding std and extra first
314314
ifeq ($(NO_REBUILD),)
315-
STDTESTDEP_$(1)_$(2)_$(3) = $$(SREQ$(1)_T_$(2)_H_$(3)) \
316-
$$(TLIB$(1)_T_$(2)_H_$(3))/$$(CFG_EXTRALIB_$(2))
315+
STDTESTDEP_$(1)_$(2)_$(3) = $$(TLIB$(1)_T_$(2)_H_$(3))/$$(CFG_EXTRALIB_$(2))
317316
else
318317
STDTESTDEP_$(1)_$(2)_$(3) =
319318
endif
320319

321320
$(3)/stage$(1)/test/stdtest-$(2)$$(X_$(2)): \
322321
$$(STDLIB_CRATE) $$(STDLIB_INPUTS) \
322+
$$(SREQ$(1)_T_$(2)_H_$(3)) \
323323
$$(STDTESTDEP_$(1)_$(2)_$(3))
324324
@$$(call E, compile_and_link: $$@)
325325
$$(STAGE$(1)_T_$(2)_H_$(3)) -o $$@ $$< --test
326326

327327
$(3)/stage$(1)/test/extratest-$(2)$$(X_$(2)): \
328328
$$(EXTRALIB_CRATE) $$(EXTRALIB_INPUTS) \
329+
$$(SREQ$(1)_T_$(2)_H_$(3)) \
329330
$$(STDTESTDEP_$(1)_$(2)_$(3))
330331
@$$(call E, compile_and_link: $$@)
331332
$$(STAGE$(1)_T_$(2)_H_$(3)) -o $$@ $$< --test
332333

333334
$(3)/stage$(1)/test/syntaxtest-$(2)$$(X_$(2)): \
334335
$$(LIBSYNTAX_CRATE) $$(LIBSYNTAX_INPUTS) \
336+
$$(SREQ$(1)_T_$(2)_H_$(3)) \
335337
$$(STDTESTDEP_$(1)_$(2)_$(3))
336338
@$$(call E, compile_and_link: $$@)
337339
$$(STAGE$(1)_T_$(2)_H_$(3)) -o $$@ $$< --test

branches/auto/src/libextra/arena.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ unsafe fn destroy_chunk(chunk: &Chunk) {
116116
let fill = chunk.fill;
117117

118118
while idx < fill {
119-
let tydesc_data: *uint = transmute(ptr::offset(buf, idx as int));
119+
let tydesc_data: *uint = transmute(ptr::offset(buf, idx));
120120
let (tydesc, is_done) = un_bitpack_tydesc_ptr(*tydesc_data);
121121
let (size, align) = ((*tydesc).size, (*tydesc).align);
122122

@@ -127,7 +127,7 @@ unsafe fn destroy_chunk(chunk: &Chunk) {
127127
//debug!("freeing object: idx = %u, size = %u, align = %u, done = %b",
128128
// start, size, align, is_done);
129129
if is_done {
130-
((*tydesc).drop_glue)(ptr::offset(buf, start as int) as *i8);
130+
((*tydesc).drop_glue)(ptr::offset(buf, start) as *i8);
131131
}
132132

133133
// Find where the next tydesc lives
@@ -176,7 +176,7 @@ impl Arena {
176176
//debug!("idx = %u, size = %u, align = %u, fill = %u",
177177
// start, n_bytes, align, head.fill);
178178

179-
ptr::offset(vec::raw::to_ptr(this.pod_head.data), start as int)
179+
ptr::offset(vec::raw::to_ptr(this.pod_head.data), start)
180180
}
181181
}
182182

@@ -233,7 +233,7 @@ impl Arena {
233233
// start, n_bytes, align, head.fill);
234234

235235
let buf = vec::raw::to_ptr(self.head.data);
236-
return (ptr::offset(buf, tydesc_start as int), ptr::offset(buf, start as int));
236+
return (ptr::offset(buf, tydesc_start), ptr::offset(buf, start));
237237
}
238238
}
239239

branches/auto/src/libextra/bitv.rs

Lines changed: 4 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,11 @@
1212

1313

1414
use std::cmp;
15-
use std::iterator::{DoubleEndedIterator, RandomAccessIterator, Invert};
1615
use std::num;
1716
use std::ops;
1817
use std::uint;
1918
use std::vec;
2019

21-
2220
#[deriving(Clone)]
2321
struct SmallBitv {
2422
/// only the lowest nbits of this value are used. the rest is undefined.
@@ -406,12 +404,7 @@ impl Bitv {
406404

407405
#[inline]
408406
pub fn iter<'a>(&'a self) -> BitvIterator<'a> {
409-
BitvIterator {bitv: self, next_idx: 0, end_idx: self.nbits}
410-
}
411-
412-
#[inline]
413-
pub fn rev_liter<'a>(&'a self) -> Invert<BitvIterator<'a>> {
414-
self.iter().invert()
407+
BitvIterator {bitv: self, next_idx: 0}
415408
}
416409

417410
/// Returns true if all bits are 0
@@ -571,14 +564,13 @@ fn iterate_bits(base: uint, bits: uint, f: &fn(uint) -> bool) -> bool {
571564
/// An iterator for Bitv
572565
pub struct BitvIterator<'self> {
573566
priv bitv: &'self Bitv,
574-
priv next_idx: uint,
575-
priv end_idx: uint,
567+
priv next_idx: uint
576568
}
577569

578570
impl<'self> Iterator<bool> for BitvIterator<'self> {
579571
#[inline]
580572
fn next(&mut self) -> Option<bool> {
581-
if self.next_idx != self.end_idx {
573+
if self.next_idx < self.bitv.nbits {
582574
let idx = self.next_idx;
583575
self.next_idx += 1;
584576
Some(self.bitv.get(idx))
@@ -588,39 +580,11 @@ impl<'self> Iterator<bool> for BitvIterator<'self> {
588580
}
589581

590582
fn size_hint(&self) -> (uint, Option<uint>) {
591-
let rem = self.end_idx - self.next_idx;
583+
let rem = self.bitv.nbits - self.next_idx;
592584
(rem, Some(rem))
593585
}
594586
}
595587

596-
impl<'self> DoubleEndedIterator<bool> for BitvIterator<'self> {
597-
#[inline]
598-
fn next_back(&mut self) -> Option<bool> {
599-
if self.next_idx != self.end_idx {
600-
self.end_idx -= 1;
601-
Some(self.bitv.get(self.end_idx))
602-
} else {
603-
None
604-
}
605-
}
606-
}
607-
608-
impl<'self> RandomAccessIterator<bool> for BitvIterator<'self> {
609-
#[inline]
610-
fn indexable(&self) -> uint {
611-
self.end_idx - self.next_idx
612-
}
613-
614-
#[inline]
615-
fn idx(&self, index: uint) -> Option<bool> {
616-
if index >= self.indexable() {
617-
None
618-
} else {
619-
Some(self.bitv.get(index))
620-
}
621-
}
622-
}
623-
624588
/// An implementation of a set using a bit vector as an underlying
625589
/// representation for holding numerical elements.
626590
///

branches/auto/src/libextra/c_vec.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ pub unsafe fn c_vec_with_dtor<T>(base: *mut T, len: uint, dtor: @fn())
122122
pub fn get<T:Clone>(t: CVec<T>, ofs: uint) -> T {
123123
assert!(ofs < len(t));
124124
return unsafe {
125-
(*ptr::mut_offset(t.base, ofs as int)).clone()
125+
(*ptr::mut_offset(t.base, ofs)).clone()
126126
};
127127
}
128128

@@ -133,7 +133,7 @@ pub fn get<T:Clone>(t: CVec<T>, ofs: uint) -> T {
133133
*/
134134
pub fn set<T>(t: CVec<T>, ofs: uint, v: T) {
135135
assert!(ofs < len(t));
136-
unsafe { *ptr::mut_offset(t.base, ofs as int) = v };
136+
unsafe { *ptr::mut_offset(t.base, ofs) = v };
137137
}
138138

139139
/*

branches/auto/src/libextra/dlist.rs

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
use std::cast;
2626
use std::ptr;
2727
use std::util;
28-
use std::iterator::{FromIterator, Extendable, Invert};
28+
use std::iterator::{FromIterator, InvertIterator};
2929

3030
use container::Deque;
3131

@@ -356,7 +356,7 @@ impl<T> DList<T> {
356356

357357
/// Provide a reverse iterator
358358
#[inline]
359-
pub fn rev_iter<'a>(&'a self) -> Invert<DListIterator<'a, T>> {
359+
pub fn rev_iter<'a>(&'a self) -> InvertIterator<DListIterator<'a, T>> {
360360
self.iter().invert()
361361
}
362362

@@ -376,7 +376,7 @@ impl<T> DList<T> {
376376
}
377377
/// Provide a reverse iterator with mutable references
378378
#[inline]
379-
pub fn mut_rev_iter<'a>(&'a mut self) -> Invert<MutDListIterator<'a, T>> {
379+
pub fn mut_rev_iter<'a>(&'a mut self) -> InvertIterator<MutDListIterator<'a, T>> {
380380
self.mut_iter().invert()
381381
}
382382

@@ -389,7 +389,7 @@ impl<T> DList<T> {
389389

390390
/// Consume the list into an iterator yielding elements by value, in reverse
391391
#[inline]
392-
pub fn consume_rev_iter(self) -> Invert<ConsumeIterator<T>> {
392+
pub fn consume_rev_iter(self) -> InvertIterator<ConsumeIterator<T>> {
393393
self.consume_iter().invert()
394394
}
395395
}
@@ -541,17 +541,11 @@ impl<A> DoubleEndedIterator<A> for ConsumeIterator<A> {
541541
impl<A, T: Iterator<A>> FromIterator<A, T> for DList<A> {
542542
fn from_iterator(iterator: &mut T) -> DList<A> {
543543
let mut ret = DList::new();
544-
ret.extend(iterator);
544+
for iterator.advance |elt| { ret.push_back(elt); }
545545
ret
546546
}
547547
}
548548

549-
impl<A, T: Iterator<A>> Extendable<A, T> for DList<A> {
550-
fn extend(&mut self, iterator: &mut T) {
551-
for iterator.advance |elt| { self.push_back(elt); }
552-
}
553-
}
554-
555549
impl<A: Eq> Eq for DList<A> {
556550
fn eq(&self, other: &DList<A>) -> bool {
557551
self.len() == other.len() &&

branches/auto/src/libextra/ebml.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ pub mod reader {
150150

151151
unsafe {
152152
let (ptr, _): (*u8, uint) = transmute(data);
153-
let ptr = offset(ptr, start as int);
153+
let ptr = offset(ptr, start);
154154
let ptr: *i32 = transmute(ptr);
155155
let val = bswap32(*ptr);
156156
let val: u32 = transmute(val);

branches/auto/src/libextra/getopts.rs

Lines changed: 2 additions & 98 deletions
Original file line numberDiff line numberDiff line change
@@ -476,6 +476,7 @@ pub mod groups {
476476
use getopts::{HasArg, Long, Maybe, Multi, No, Occur, Opt, Optional, Req};
477477
use getopts::{Short, Yes};
478478

479+
use std::str;
479480
use std::vec;
480481

481482
/** one group of options, e.g., both -h and --help, along with
@@ -666,7 +667,7 @@ pub mod groups {
666667

667668
// FIXME: #5516
668669
let mut desc_rows = ~[];
669-
for each_split_within(desc_normalized_whitespace, 54) |substr| {
670+
for str::each_split_within(desc_normalized_whitespace, 54) |substr| {
670671
desc_rows.push(substr.to_owned());
671672
}
672673

@@ -682,103 +683,6 @@ pub mod groups {
682683
rows.collect::<~[~str]>().connect("\n") +
683684
"\n\n";
684685
}
685-
686-
/** Splits a string into substrings with possibly internal whitespace,
687-
* each of them at most `lim` bytes long. The substrings have leading and trailing
688-
* whitespace removed, and are only cut at whitespace boundaries.
689-
*
690-
* Note: Function was moved here from `std::str` because this module is the only place that
691-
* uses it, and because it was to specific for a general string function.
692-
*
693-
* #Failure:
694-
*
695-
* Fails during iteration if the string contains a non-whitespace
696-
* sequence longer than the limit.
697-
*/
698-
priv fn each_split_within<'a>(ss: &'a str,
699-
lim: uint,
700-
it: &fn(&'a str) -> bool) -> bool {
701-
// Just for fun, let's write this as an state machine:
702-
703-
enum SplitWithinState {
704-
A, // leading whitespace, initial state
705-
B, // words
706-
C, // internal and trailing whitespace
707-
}
708-
enum Whitespace {
709-
Ws, // current char is whitespace
710-
Cr // current char is not whitespace
711-
}
712-
enum LengthLimit {
713-
UnderLim, // current char makes current substring still fit in limit
714-
OverLim // current char makes current substring no longer fit in limit
715-
}
716-
717-
let mut slice_start = 0;
718-
let mut last_start = 0;
719-
let mut last_end = 0;
720-
let mut state = A;
721-
let mut fake_i = ss.len();
722-
let mut lim = lim;
723-
724-
let mut cont = true;
725-
let slice: &fn() = || { cont = it(ss.slice(slice_start, last_end)) };
726-
727-
// if the limit is larger than the string, lower it to save cycles
728-
if (lim >= fake_i) {
729-
lim = fake_i;
730-
}
731-
732-
let machine: &fn((uint, char)) -> bool = |(i, c)| {
733-
let whitespace = if ::std::char::is_whitespace(c) { Ws } else { Cr };
734-
let limit = if (i - slice_start + 1) <= lim { UnderLim } else { OverLim };
735-
736-
state = match (state, whitespace, limit) {
737-
(A, Ws, _) => { A }
738-
(A, Cr, _) => { slice_start = i; last_start = i; B }
739-
740-
(B, Cr, UnderLim) => { B }
741-
(B, Cr, OverLim) if (i - last_start + 1) > lim
742-
=> fail!("word starting with %? longer than limit!",
743-
ss.slice(last_start, i + 1)),
744-
(B, Cr, OverLim) => { slice(); slice_start = last_start; B }
745-
(B, Ws, UnderLim) => { last_end = i; C }
746-
(B, Ws, OverLim) => { last_end = i; slice(); A }
747-
748-
(C, Cr, UnderLim) => { last_start = i; B }
749-
(C, Cr, OverLim) => { slice(); slice_start = i; last_start = i; last_end = i; B }
750-
(C, Ws, OverLim) => { slice(); A }
751-
(C, Ws, UnderLim) => { C }
752-
};
753-
754-
cont
755-
};
756-
757-
ss.iter().enumerate().advance(|x| machine(x));
758-
759-
// Let the automaton 'run out' by supplying trailing whitespace
760-
while cont && match state { B | C => true, A => false } {
761-
machine((fake_i, ' '));
762-
fake_i += 1;
763-
}
764-
return cont;
765-
}
766-
767-
#[test]
768-
priv fn test_split_within() {
769-
fn t(s: &str, i: uint, u: &[~str]) {
770-
let mut v = ~[];
771-
for each_split_within(s, i) |s| { v.push(s.to_owned()) }
772-
assert!(v.iter().zip(u.iter()).all(|(a,b)| a == b));
773-
}
774-
t("", 0, []);
775-
t("", 15, []);
776-
t("hello", 15, [~"hello"]);
777-
t("\nMary had a little lamb\nLittle lamb\n", 15,
778-
[~"Mary had a", ~"little lamb", ~"Little lamb"]);
779-
t("\nMary had a little lamb\nLittle lamb\n", ::std::uint::max_value,
780-
[~"Mary had a little lamb\nLittle lamb"]);
781-
}
782686
} // end groups module
783687

784688
#[cfg(test)]

branches/auto/src/libextra/par.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ fn map_slices<A:Clone + Send,B:Clone + Send>(
5858
let f = do future_spawn() || {
5959
unsafe {
6060
let len = end - base;
61-
let slice = (ptr::offset(p, base as int),
61+
let slice = (ptr::offset(p, base),
6262
len * sys::size_of::<A>());
6363
info!("pre-slice: %?", (base, slice));
6464
let slice : &[A] =

0 commit comments

Comments
 (0)