Skip to content

Commit 90d1cf2

Browse files
author
blake2-ppc
committed
---
yaml --- r: 143069 b: refs/heads/try2 c: 435fcda h: refs/heads/master i: 143067: 50c77dd v: v3
1 parent 57a8ecf commit 90d1cf2

31 files changed

+218
-166
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ refs/heads/snap-stage3: 78a7676898d9f80ab540c6df5d4c9ce35bb50463
55
refs/heads/try: 519addf6277dbafccbb4159db4b710c37eaa2ec5
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
8-
refs/heads/try2: bb8ca1f52cfa59e0040c2c749a1c46048fc6d48d
8+
refs/heads/try2: 435fcda5e99ad5944c780f864a550b3211a6ab47
99
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try2/src/libextra/fun_treemap.rs

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -31,17 +31,10 @@ enum TreeNode<K, V> {
3131
}
3232

3333
/// Create a treemap
34-
pub fn init<K: 'static, V: 'static>() -> Treemap<K, V> {
35-
@Empty
36-
}
34+
pub fn init<K, V>() -> Treemap<K, V> { @Empty }
3735

3836
/// Insert a value into the map
39-
pub fn insert<K:Eq + Ord + 'static,
40-
V:'static>(
41-
m: Treemap<K, V>,
42-
k: K,
43-
v: V)
44-
-> Treemap<K, V> {
37+
pub fn insert<K:Eq + Ord,V>(m: Treemap<K, V>, k: K, v: V) -> Treemap<K, V> {
4538
@match m {
4639
@Empty => Node(@k, @v, @Empty, @Empty),
4740
@Node(kk, vv, left, right) => cond!(
@@ -53,11 +46,7 @@ pub fn insert<K:Eq + Ord + 'static,
5346
}
5447

5548
/// Find a value based on the key
56-
pub fn find<K:Eq + Ord + 'static,
57-
V:Clone + 'static>(
58-
m: Treemap<K, V>,
59-
k: K)
60-
-> Option<V> {
49+
pub fn find<K:Eq + Ord,V:Clone>(m: Treemap<K, V>, k: K) -> Option<V> {
6150
match *m {
6251
Empty => None,
6352
Node(kk, v, left, right) => cond!(

branches/try2/src/libextra/list.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ pub enum MutList<T> {
2525
}
2626

2727
/// Create a list from a vector
28-
pub fn from_vec<T:Clone + 'static>(v: &[T]) -> @List<T> {
28+
pub fn from_vec<T:Clone>(v: &[T]) -> @List<T> {
2929
v.rev_iter().fold(@Nil::<T>, |t, h| @Cons((*h).clone(), t))
3030
}
3131

@@ -109,7 +109,7 @@ pub fn head<T:Clone>(ls: @List<T>) -> T {
109109
}
110110

111111
/// Appends one list to another
112-
pub fn append<T:Clone + 'static>(l: @List<T>, m: @List<T>) -> @List<T> {
112+
pub fn append<T:Clone>(l: @List<T>, m: @List<T>) -> @List<T> {
113113
match *l {
114114
Nil => return m,
115115
Cons(ref x, xs) => {

branches/try2/src/libextra/serialize.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -423,7 +423,7 @@ impl<S:Encoder,T:Encodable<S>> Encodable<S> for @T {
423423
}
424424
}
425425

426-
impl<D:Decoder,T:Decodable<D> + 'static> Decodable<D> for @T {
426+
impl<D:Decoder,T:Decodable<D>> Decodable<D> for @T {
427427
fn decode(d: &mut D) -> @T {
428428
@Decodable::decode(d)
429429
}
@@ -435,7 +435,7 @@ impl<S:Encoder,T:Encodable<S>> Encodable<S> for @mut T {
435435
}
436436
}
437437

438-
impl<D:Decoder,T:Decodable<D> + 'static> Decodable<D> for @mut T {
438+
impl<D:Decoder,T:Decodable<D>> Decodable<D> for @mut T {
439439
fn decode(d: &mut D) -> @mut T {
440440
@mut Decodable::decode(d)
441441
}

branches/try2/src/librustc/metadata/encoder.rs

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1238,9 +1238,8 @@ fn encode_info_for_items(ecx: &EncodeContext,
12381238

12391239
// Path and definition ID indexing
12401240

1241-
fn create_index<T:Clone + Hash + IterBytes + 'static>(
1242-
index: ~[entry<T>])
1243-
-> ~[@~[entry<T>]] {
1241+
fn create_index<T:Clone + Hash + IterBytes>(index: ~[entry<T>])
1242+
-> ~[@~[entry<T>]] {
12441243
let mut buckets: ~[@mut ~[entry<T>]] = ~[];
12451244
for uint::range(0u, 256u) |_i| { buckets.push(@mut ~[]); };
12461245
for index.iter().advance |elt| {
@@ -1255,10 +1254,9 @@ fn create_index<T:Clone + Hash + IterBytes + 'static>(
12551254
return buckets_frozen;
12561255
}
12571256

1258-
fn encode_index<T:'static>(
1259-
ebml_w: &mut writer::Encoder,
1260-
buckets: ~[@~[entry<T>]],
1261-
write_fn: &fn(@io::Writer, &T)) {
1257+
fn encode_index<T>(ebml_w: &mut writer::Encoder,
1258+
buckets: ~[@~[entry<T>]],
1259+
write_fn: &fn(@io::Writer, &T)) {
12621260
let writer = ebml_w.writer;
12631261
ebml_w.start_tag(tag_index);
12641262
let mut bucket_locs: ~[uint] = ~[];

branches/try2/src/librustc/middle/kind.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -285,10 +285,6 @@ pub fn check_expr(e: @expr, (cx, v): (Context, visit::vt<Context>)) {
285285
}
286286

287287
match e.node {
288-
expr_unary(_, box(_), interior) => {
289-
let interior_type = ty::expr_ty(cx.tcx, interior);
290-
let _ = check_durable(cx.tcx, interior_type, interior.span);
291-
}
292288
expr_cast(source, _) => {
293289
check_cast_for_escaping_regions(cx, source, e);
294290
match ty::get(ty::expr_ty(cx.tcx, e)).sty {

branches/try2/src/librustc/middle/subst.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ impl<T:Subst> Subst for ~[T] {
7979
}
8080
}
8181

82-
impl<T:Subst + 'static> Subst for @T {
82+
impl<T:Subst> Subst for @T {
8383
fn subst(&self, tcx: ty::ctxt, substs: &ty::substs) -> @T {
8484
match self {
8585
&@ref t => @t.subst(tcx, substs)

branches/try2/src/librustc/middle/ty.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -858,7 +858,7 @@ fn mk_rcache() -> creader_cache {
858858
return @mut HashMap::new();
859859
}
860860

861-
pub fn new_ty_hash<V:'static>() -> @mut HashMap<t, V> {
861+
pub fn new_ty_hash<V>() -> @mut HashMap<t, V> {
862862
@mut HashMap::new()
863863
}
864864

branches/try2/src/libstd/clone.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,15 +112,15 @@ impl<T: DeepClone> DeepClone for ~T {
112112
}
113113

114114
// FIXME: #6525: should also be implemented for `T: Send + DeepClone`
115-
impl<T: Freeze + DeepClone + 'static> DeepClone for @T {
115+
impl<T: Freeze + DeepClone> DeepClone for @T {
116116
/// Return a deep copy of the managed box. The `Freeze` trait is required to prevent performing
117117
/// a deep clone of a potentially cyclical type.
118118
#[inline]
119119
fn deep_clone(&self) -> @T { @(**self).deep_clone() }
120120
}
121121

122122
// FIXME: #6525: should also be implemented for `T: Send + DeepClone`
123-
impl<T: Freeze + DeepClone + 'static> DeepClone for @mut T {
123+
impl<T: Freeze + DeepClone> DeepClone for @mut T {
124124
/// Return a deep copy of the managed box. The `Freeze` trait is required to prevent performing
125125
/// a deep clone of a potentially cyclical type.
126126
#[inline]

branches/try2/src/libstd/iterator.rs

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -729,6 +729,55 @@ impl<A: Ord, T: Iterator<A>> OrdIterator<A> for T {
729729
}
730730
}
731731

732+
/// A trait for iterators that are clonable.
733+
// FIXME #6967: Dummy A parameter to get around type inference bug
734+
pub trait ClonableIterator<A> {
735+
/// Repeats an iterator endlessly
736+
///
737+
/// # Example
738+
///
739+
/// ~~~ {.rust}
740+
/// let a = Counter::new(1,1).take_(1);
741+
/// let mut cy = a.cycle();
742+
/// assert_eq!(cy.next(), Some(1));
743+
/// assert_eq!(cy.next(), Some(1));
744+
/// ~~~
745+
fn cycle(self) -> CycleIterator<A, Self>;
746+
}
747+
748+
impl<A, T: Clone + Iterator<A>> ClonableIterator<A> for T {
749+
#[inline]
750+
fn cycle(self) -> CycleIterator<A, T> {
751+
CycleIterator{orig: self.clone(), iter: self}
752+
}
753+
}
754+
755+
/// An iterator that repeats endlessly
756+
pub struct CycleIterator<A, T> {
757+
priv orig: T,
758+
priv iter: T,
759+
}
760+
761+
impl<A, T: Clone + Iterator<A>> Iterator<A> for CycleIterator<A, T> {
762+
#[inline]
763+
fn next(&mut self) -> Option<A> {
764+
match self.iter.next() {
765+
None => { self.iter = self.orig.clone(); self.iter.next() }
766+
y => y
767+
}
768+
}
769+
770+
#[inline]
771+
fn size_hint(&self) -> (uint, Option<uint>) {
772+
// the cycle iterator is either empty or infinite
773+
match self.orig.size_hint() {
774+
sz @ (0, Some(0)) => sz,
775+
(0, _) => (0, None),
776+
_ => (uint::max_value, None)
777+
}
778+
}
779+
}
780+
732781
/// An iterator which strings two iterators together
733782
// FIXME #6967: Dummy A parameter to get around type inference bug
734783
pub struct ChainIterator<A, T, U> {

branches/try2/src/libstd/num/num.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -446,12 +446,12 @@ pub fn pow_with_uint<T:NumCast+One+Zero+Div<T,T>+Mul<T,T>>(radix: uint, pow: uin
446446
total
447447
}
448448

449-
impl<T: Zero + 'static> Zero for @mut T {
449+
impl<T: Zero> Zero for @mut T {
450450
fn zero() -> @mut T { @mut Zero::zero() }
451451
fn is_zero(&self) -> bool { (**self).is_zero() }
452452
}
453453

454-
impl<T: Zero + 'static> Zero for @T {
454+
impl<T: Zero> Zero for @T {
455455
fn zero() -> @T { @Zero::zero() }
456456
fn is_zero(&self) -> bool { (**self).is_zero() }
457457
}

branches/try2/src/libstd/rand.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ impl<T: Rand> Rand for ~T {
242242
fn rand<R: Rng>(rng: &mut R) -> ~T { ~rng.gen() }
243243
}
244244

245-
impl<T: Rand + 'static> Rand for @T {
245+
impl<T: Rand> Rand for @T {
246246
#[inline]
247247
fn rand<R: Rng>(rng: &mut R) -> @T { @rng.gen() }
248248
}

branches/try2/src/libstd/rt/comm.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,11 @@
99
// except according to those terms.
1010

1111
//! Ports and channels.
12+
//!
13+
//! XXX: Carefully consider whether the sequentially consistent
14+
//! atomics here can be converted to acq/rel. I'm not sure they can,
15+
//! because there is data being transerred in both directions (the payload
16+
//! goes from sender to receiver and the task pointer goes the other way).
1217
1318
use option::*;
1419
use cast;

branches/try2/src/libstd/rt/io/net/udp.rs

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ impl UdpSocket {
3030
}
3131
}
3232

33-
pub fn recvfrom(&mut self, buf: &mut [u8]) -> Option<(uint, IpAddr)> {
33+
pub fn recvfrom(&self, buf: &mut [u8]) -> Option<(uint, IpAddr)> {
3434
match (**self).recvfrom(buf) {
3535
Ok((nread, src)) => Some((nread, src)),
3636
Err(ioerr) => {
@@ -43,7 +43,7 @@ impl UdpSocket {
4343
}
4444
}
4545

46-
pub fn sendto(&mut self, buf: &[u8], dst: IpAddr) {
46+
pub fn sendto(&self, buf: &[u8], dst: IpAddr) {
4747
match (**self).sendto(buf, dst) {
4848
Ok(_) => (),
4949
Err(ioerr) => io_error::cond.raise(ioerr),
@@ -61,17 +61,16 @@ pub struct UdpStream {
6161
}
6262

6363
impl UdpStream {
64-
pub fn as_socket<T>(&mut self, f: &fn(&mut UdpSocket) -> T) -> T { f(&mut self.socket) }
64+
pub fn as_socket<T>(&self, f: &fn(&UdpSocket) -> T) -> T { f(&self.socket) }
6565

6666
pub fn disconnect(self) -> UdpSocket { self.socket }
6767
}
6868

6969
impl Reader for UdpStream {
7070
fn read(&mut self, buf: &mut [u8]) -> Option<uint> {
71-
let peer = self.connectedTo;
7271
do self.as_socket |sock| {
7372
match sock.recvfrom(buf) {
74-
Some((_nread, src)) if src != peer => Some(0),
73+
Some((_nread, src)) if src != self.connectedTo => Some(0),
7574
Some((nread, _src)) => Some(nread),
7675
None => None,
7776
}
@@ -123,7 +122,7 @@ mod test {
123122

124123
do spawntask_immediately {
125124
match UdpSocket::bind(server_ip) {
126-
Some(ref mut server) => {
125+
Some(server) => {
127126
let mut buf = [0];
128127
match server.recvfrom(buf) {
129128
Some((nread, src)) => {
@@ -140,7 +139,7 @@ mod test {
140139

141140
do spawntask_immediately {
142141
match UdpSocket::bind(client_ip) {
143-
Some(ref mut client) => client.sendto([99], server_ip),
142+
Some(client) => client.sendto([99], server_ip),
144143
None => fail!()
145144
}
146145
}
@@ -155,7 +154,7 @@ mod test {
155154

156155
do spawntask_immediately {
157156
match UdpSocket::bind(server_ip) {
158-
Some(ref mut server) => {
157+
Some(server) => {
159158
let mut buf = [0];
160159
match server.recvfrom(buf) {
161160
Some((nread, src)) => {
@@ -172,7 +171,7 @@ mod test {
172171

173172
do spawntask_immediately {
174173
match UdpSocket::bind(client_ip) {
175-
Some(ref mut client) => client.sendto([99], server_ip),
174+
Some(client) => client.sendto([99], server_ip),
176175
None => fail!()
177176
}
178177
}

branches/try2/src/libstd/rt/rtio.rs

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -50,37 +50,37 @@ pub trait IoFactory {
5050

5151
pub trait RtioTcpListener : RtioSocket {
5252
fn accept(&mut self) -> Result<~RtioTcpStreamObject, IoError>;
53-
fn accept_simultaneously(&mut self);
54-
fn dont_accept_simultaneously(&mut self);
53+
fn accept_simultaneously(&self);
54+
fn dont_accept_simultaneously(&self);
5555
}
5656

5757
pub trait RtioTcpStream : RtioSocket {
58-
fn read(&mut self, buf: &mut [u8]) -> Result<uint, IoError>;
59-
fn write(&mut self, buf: &[u8]) -> Result<(), IoError>;
60-
fn peer_name(&mut self) -> IpAddr;
61-
fn control_congestion(&mut self);
62-
fn nodelay(&mut self);
63-
fn keepalive(&mut self, delay_in_seconds: uint);
64-
fn letdie(&mut self);
58+
fn read(&self, buf: &mut [u8]) -> Result<uint, IoError>;
59+
fn write(&self, buf: &[u8]) -> Result<(), IoError>;
60+
fn peer_name(&self) -> IpAddr;
61+
fn control_congestion(&self);
62+
fn nodelay(&self);
63+
fn keepalive(&self, delay_in_seconds: uint);
64+
fn letdie(&self);
6565
}
6666

6767
pub trait RtioSocket {
68-
fn socket_name(&mut self) -> IpAddr;
68+
fn socket_name(&self) -> IpAddr;
6969
}
7070

7171
pub trait RtioUdpSocket : RtioSocket {
72-
fn recvfrom(&mut self, buf: &mut [u8]) -> Result<(uint, IpAddr), IoError>;
73-
fn sendto(&mut self, buf: &[u8], dst: IpAddr) -> Result<(), IoError>;
72+
fn recvfrom(&self, buf: &mut [u8]) -> Result<(uint, IpAddr), IoError>;
73+
fn sendto(&self, buf: &[u8], dst: IpAddr) -> Result<(), IoError>;
7474

75-
fn join_multicast(&mut self, multi: IpAddr);
76-
fn leave_multicast(&mut self, multi: IpAddr);
75+
fn join_multicast(&self, multi: IpAddr);
76+
fn leave_multicast(&self, multi: IpAddr);
7777

78-
fn loop_multicast_locally(&mut self);
79-
fn dont_loop_multicast_locally(&mut self);
78+
fn loop_multicast_locally(&self);
79+
fn dont_loop_multicast_locally(&self);
8080

81-
fn multicast_time_to_live(&mut self, ttl: int);
82-
fn time_to_live(&mut self, ttl: int);
81+
fn multicast_time_to_live(&self, ttl: int);
82+
fn time_to_live(&self, ttl: int);
8383

84-
fn hear_broadcasts(&mut self);
85-
fn ignore_broadcasts(&mut self);
84+
fn hear_broadcasts(&self);
85+
fn ignore_broadcasts(&self);
8686
}

0 commit comments

Comments
 (0)