Skip to content

Commit 913a364

Browse files
committed
---
yaml --- r: 61434 b: refs/heads/try c: f7e58eb h: refs/heads/master v: v3
1 parent dc4a174 commit 913a364

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
@@ -2,7 +2,7 @@
22
refs/heads/master: 2d28d645422c1617be58c8ca7ad9a457264ca850
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 2d28d645422c1617be58c8ca7ad9a457264ca850
5-
refs/heads/try: 290a2ebab61282d89b211192679e84d22a01fd14
5+
refs/heads/try: f7e58ebe84513ed65b1694311f8c4f35e53e8c0e
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c

branches/try/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/try/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)