Skip to content

Commit 2c5332a

Browse files
committed
---
yaml --- r: 60434 b: refs/heads/auto c: f7e58eb h: refs/heads/master v: v3
1 parent b6f470a commit 2c5332a

File tree

3 files changed

+13
-13
lines changed

3 files changed

+13
-13
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: 290a2ebab61282d89b211192679e84d22a01fd14
17+
refs/heads/auto: f7e58ebe84513ed65b1694311f8c4f35e53e8c0e
1818
refs/heads/servo: af82457af293e2a842ba6b7759b70288da276167
1919
refs/tags/release-0.6: b4ebcfa1812664df5e142f0134a5faea3918544c

branches/auto/src/libcore/iterator.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ pub trait IteratorUtil<A> {
4545
fn advance(&mut self, f: &fn(A) -> bool);
4646
#[cfg(not(stage0))]
4747
fn advance(&mut self, f: &fn(A) -> bool) -> bool;
48+
fn to_vec(self) -> ~[A];
4849
}
4950

5051
/// Iterator adaptors provided for every `Iterator` implementation. The adaptor objects are also
@@ -131,6 +132,14 @@ impl<A, T: Iterator<A>> IteratorUtil<A> for T {
131132
}
132133
}
133134
}
135+
136+
#[inline(always)]
137+
fn to_vec(self) -> ~[A] {
138+
let mut v = ~[];
139+
let mut it = self;
140+
for it.advance() |x| { v.push(x); }
141+
return v;
142+
}
134143
}
135144

136145
pub struct ChainIterator<T, U> {

branches/auto/src/libcore/util.rs

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -138,8 +138,8 @@ pub enum Void { }
138138

139139
pub impl Void {
140140
/// A utility function for ignoring this uninhabited type
141-
fn uninhabited(self) -> ! {
142-
match self {
141+
fn uninhabited(&self) -> ! {
142+
match *self {
143143
// Nothing to match on
144144
}
145145
}
@@ -177,8 +177,7 @@ pub fn unreachable() -> ! {
177177
#[cfg(test)]
178178
mod tests {
179179
use option::{None, Some};
180-
use util::{Void, NonCopyable, id, replace, swap};
181-
use either::{Either, Left, Right};
180+
use util::{NonCopyable, id, replace, swap};
182181

183182
#[test]
184183
pub fn identity_crisis() {
@@ -203,12 +202,4 @@ mod tests {
203202
assert!(x.is_none());
204203
assert!(y.is_some());
205204
}
206-
#[test]
207-
pub fn test_uninhabited() {
208-
let could_only_be_coin : Either <Void, ()> = Right (());
209-
match could_only_be_coin {
210-
Right (coin) => coin,
211-
Left (is_void) => is_void.uninhabited ()
212-
}
213-
}
214205
}

0 commit comments

Comments
 (0)