Skip to content

Commit 8095428

Browse files
committed
---
yaml --- r: 80785 b: refs/heads/try c: 10c8978 h: refs/heads/master i: 80783: 2b5e242 v: v3
1 parent 5c498ce commit 8095428

File tree

3 files changed

+15
-46
lines changed

3 files changed

+15
-46
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: 4c6bf4872012c010f84dc7fa2cdfe87522533f89
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: cbd1eefbd350797b783df119fed7956d7e1c74ad
5-
refs/heads/try: 9357f8f4cdc6d3a7c454d0b2e3ffbaad997f315e
5+
refs/heads/try: 10c8978edbb53fda8b33758a0bf3f9154b20dc9e
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c

branches/try/src/libstd/comm.rs

Lines changed: 9 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,15 @@ pub fn stream<T: Send>() -> (Port<T>, Chan<T>) {
6666
(Port { x: p }, Chan { x: c })
6767
}
6868

69+
pub struct SharedChan<T> { x: rtcomm::SharedChan<T> }
70+
71+
impl<T: Send> SharedChan<T> {
72+
pub fn new(c: Chan<T>) -> SharedChan<T> {
73+
let Chan { x: c } = c;
74+
SharedChan { x: rtcomm::SharedChan::new(c) }
75+
}
76+
}
77+
6978
impl<T: Send> ChanOne<T> {
7079
pub fn send(self, val: T) {
7180
let ChanOne { x: c } = self;
@@ -152,16 +161,6 @@ impl<T: Send> Peekable<T> for Port<T> {
152161
}
153162
}
154163

155-
156-
pub struct SharedChan<T> { x: rtcomm::SharedChan<T> }
157-
158-
impl<T: Send> SharedChan<T> {
159-
pub fn new(c: Chan<T>) -> SharedChan<T> {
160-
let Chan { x: c } = c;
161-
SharedChan { x: rtcomm::SharedChan::new(c) }
162-
}
163-
}
164-
165164
impl<T: Send> GenericChan<T> for SharedChan<T> {
166165
fn send(&self, val: T) {
167166
let &SharedChan { x: ref c } = self;
@@ -194,31 +193,3 @@ impl<T> Clone for SharedChan<T> {
194193
SharedChan { x: c.clone() }
195194
}
196195
}
197-
198-
pub struct SharedPort<T> { x: rtcomm::SharedPort<T> }
199-
200-
impl<T: Send> SharedPort<T> {
201-
pub fn new(p: Port<T>) -> SharedPort<T> {
202-
let Port { x: p } = p;
203-
SharedPort { x: rtcomm::SharedPort::new(p) }
204-
}
205-
}
206-
207-
impl<T: Send> GenericPort<T> for SharedPort<T> {
208-
fn recv(&self) -> T {
209-
let &SharedPort { x: ref p } = self;
210-
p.recv()
211-
}
212-
213-
fn try_recv(&self) -> Option<T> {
214-
let &SharedPort { x: ref p } = self;
215-
p.try_recv()
216-
}
217-
}
218-
219-
impl<T> Clone for SharedPort<T> {
220-
fn clone(&self) -> SharedPort<T> {
221-
let &SharedPort { x: ref p } = self;
222-
SharedPort { x: p.clone() }
223-
}
224-
}

branches/try/src/libstd/iter.rs

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1719,7 +1719,7 @@ pub fn count<A>(start: A, step: A) -> Counter<A> {
17191719
Counter{state: start, step: step}
17201720
}
17211721

1722-
/// A range of numbers from [0, N)
1722+
/// An iterator over the range [start, stop)
17231723
#[deriving(Clone, DeepClone)]
17241724
pub struct Range<A> {
17251725
priv state: A,
@@ -1749,14 +1749,12 @@ impl<A: Add<A, A> + Ord + Clone> Iterator<A> for Range<A> {
17491749
// Blocked on #8605 Need numeric trait for converting to `Option<uint>`
17501750
}
17511751

1752-
impl<A: Sub<A, A> + Integer + Ord + Clone> DoubleEndedIterator<A> for Range<A> {
1752+
/// `Integer` is required to ensure the range will be the same regardless of
1753+
/// the direction it is consumed.
1754+
impl<A: Integer + Ord + Clone> DoubleEndedIterator<A> for Range<A> {
17531755
#[inline]
17541756
fn next_back(&mut self) -> Option<A> {
17551757
if self.stop > self.state {
1756-
// Integer doesn't technically define this rule, but we're going to assume that every
1757-
// Integer is reachable from every other one by adding or subtracting enough Ones. This
1758-
// seems like a reasonable-enough rule that every Integer should conform to, even if it
1759-
// can't be statically checked.
17601758
self.stop = self.stop - self.one;
17611759
Some(self.stop.clone())
17621760
} else {
@@ -1765,7 +1763,7 @@ impl<A: Sub<A, A> + Integer + Ord + Clone> DoubleEndedIterator<A> for Range<A> {
17651763
}
17661764
}
17671765

1768-
/// A range of numbers from [0, N]
1766+
/// An iterator over the range [start, stop]
17691767
#[deriving(Clone, DeepClone)]
17701768
pub struct RangeInclusive<A> {
17711769
priv range: Range<A>,

0 commit comments

Comments
 (0)