diff options
| author | Patrick Walton <pcwalton@mimiga.net> | 2013-03-14 11:22:51 -0700 |
|---|---|---|
| committer | Patrick Walton <pcwalton@mimiga.net> | 2013-03-18 11:45:59 -0700 |
| commit | 299995c2b62c520708d450e4b7c6d360be0fd852 (patch) | |
| tree | 3d2fecdcc467d3dafc74fc627a4784838ec2d0a7 /src/libstd | |
| parent | f54adca7c984c75334d9cb73ec85bf3b5c326ed9 (diff) | |
| download | rust-299995c2b62c520708d450e4b7c6d360be0fd852.tar.gz rust-299995c2b62c520708d450e4b7c6d360be0fd852.zip | |
librustc: Convert all uses of old lifetime notation to new lifetime notation. rs=delifetiming
Diffstat (limited to 'src/libstd')
| -rw-r--r-- | src/libstd/arc.rs | 14 | ||||
| -rw-r--r-- | src/libstd/arena.rs | 6 | ||||
| -rw-r--r-- | src/libstd/base64.rs | 4 | ||||
| -rw-r--r-- | src/libstd/bigint.rs | 40 | ||||
| -rw-r--r-- | src/libstd/deque.rs | 8 | ||||
| -rw-r--r-- | src/libstd/future.rs | 2 | ||||
| -rw-r--r-- | src/libstd/json.rs | 6 | ||||
| -rw-r--r-- | src/libstd/priority_queue.rs | 4 | ||||
| -rw-r--r-- | src/libstd/serialize.rs | 6 | ||||
| -rw-r--r-- | src/libstd/smallintmap.rs | 12 | ||||
| -rw-r--r-- | src/libstd/sort.rs | 16 | ||||
| -rw-r--r-- | src/libstd/stats.rs | 2 | ||||
| -rw-r--r-- | src/libstd/sync.rs | 24 | ||||
| -rw-r--r-- | src/libstd/test.rs | 2 | ||||
| -rw-r--r-- | src/libstd/treemap.rs | 28 |
15 files changed, 87 insertions, 87 deletions
diff --git a/src/libstd/arc.rs b/src/libstd/arc.rs index bd2f641c017..5a08884777c 100644 --- a/src/libstd/arc.rs +++ b/src/libstd/arc.rs @@ -27,8 +27,8 @@ use core::task; /// As sync::condvar, a mechanism for unlock-and-descheduling and signalling. pub struct Condvar { is_mutex: bool, - failed: &self/mut bool, - cond: &self/sync::Condvar/&self + failed: &'self mut bool, + cond: &'self sync::Condvar/&self } pub impl Condvar/&self { @@ -95,7 +95,7 @@ pub fn ARC<T:Const + Owned>(data: T) -> ARC<T> { * Access the underlying data in an atomically reference counted * wrapper. */ -pub fn get<T:Const + Owned>(rc: &a/ARC<T>) -> &a/T { +pub fn get<T:Const + Owned>(rc: &'a ARC<T>) -> &'a T { unsafe { get_shared_immutable_state(&rc.x) } } @@ -193,7 +193,7 @@ pub impl<T:Owned> MutexARC<T> { #[inline(always)] unsafe fn access_cond<U>( &self, - blk: &fn(x: &x/mut T, c: &c/Condvar) -> U) -> U + blk: &fn(x: &'x mut T, c: &'c Condvar) -> U) -> U { unsafe { let state = get_shared_mutable_state(&self.x); @@ -239,7 +239,7 @@ impl Drop for PoisonOnFail { } } -fn PoisonOnFail(failed: &r/mut bool) -> PoisonOnFail { +fn PoisonOnFail(failed: &'r mut bool) -> PoisonOnFail { PoisonOnFail { failed: ptr::to_mut_unsafe_ptr(failed) } @@ -313,7 +313,7 @@ pub impl<T:Const + Owned> RWARC<T> { } /// As write(), but with a condvar, as sync::rwlock.write_cond(). #[inline(always)] - fn write_cond<U>(&self, blk: &fn(x: &x/mut T, c: &c/Condvar) -> U) -> U { + fn write_cond<U>(&self, blk: &fn(x: &'x mut T, c: &'c Condvar) -> U) -> U { unsafe { let state = get_shared_mutable_state(&self.x); do (*borrow_rwlock(state)).write_cond |cond| { @@ -436,7 +436,7 @@ pub impl<T:Const + Owned> RWWriteMode/&self<T> { } } /// Access the pre-downgrade RWARC in write mode with a condvar. - fn write_cond<U>(&self, blk: &fn(x: &x/mut T, c: &c/Condvar) -> U) -> U { + fn write_cond<U>(&self, blk: &fn(x: &'x mut T, c: &'c Condvar) -> U) -> U { match *self { RWWriteMode { data: ref data, diff --git a/src/libstd/arena.rs b/src/libstd/arena.rs index 6b5f806f7df..68132a1c08d 100644 --- a/src/libstd/arena.rs +++ b/src/libstd/arena.rs @@ -201,7 +201,7 @@ pub impl Arena { } #[inline(always)] - fn alloc_pod<T>(&self, op: &fn() -> T) -> &self/T { + fn alloc_pod<T>(&self, op: &fn() -> T) -> &'self T { unsafe { let tydesc = sys::get_type_desc::<T>(); let ptr = self.alloc_pod_inner((*tydesc).size, (*tydesc).align); @@ -246,7 +246,7 @@ pub impl Arena { } #[inline(always)] - fn alloc_nonpod<T>(&self, op: &fn() -> T) -> &self/T { + fn alloc_nonpod<T>(&self, op: &fn() -> T) -> &'self T { unsafe { let tydesc = sys::get_type_desc::<T>(); let (ty_ptr, ptr) = @@ -268,7 +268,7 @@ pub impl Arena { // The external interface #[inline(always)] - fn alloc<T>(&self, op: &fn() -> T) -> &self/T { + fn alloc<T>(&self, op: &fn() -> T) -> &'self T { unsafe { if !rusti::needs_drop::<T>() { self.alloc_pod(op) diff --git a/src/libstd/base64.rs b/src/libstd/base64.rs index 0bd9e1eac51..56ce54be44e 100644 --- a/src/libstd/base64.rs +++ b/src/libstd/base64.rs @@ -16,7 +16,7 @@ pub trait ToBase64 { pure fn to_base64(&self) -> ~str; } -impl ToBase64 for &self/[u8] { +impl ToBase64 for &'self [u8] { pure fn to_base64(&self) -> ~str { let chars = str::chars( ~"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/" @@ -69,7 +69,7 @@ impl ToBase64 for &self/[u8] { } } -impl ToBase64 for &self/str { +impl ToBase64 for &'self str { pure fn to_base64(&self) -> ~str { str::to_bytes(*self).to_base64() } diff --git a/src/libstd/bigint.rs b/src/libstd/bigint.rs index 5c3f37faca7..e128859bb7d 100644 --- a/src/libstd/bigint.rs +++ b/src/libstd/bigint.rs @@ -1045,9 +1045,9 @@ mod biguint_tests { fail_unless!(BigUint::new(~[0, 0, -1]).to_uint() == uint::max_value); } - const sum_triples: &static/[(&static/[BigDigit], - &static/[BigDigit], - &static/[BigDigit])] = &[ + const sum_triples: &'static [(&'static [BigDigit], + &'static [BigDigit], + &'static [BigDigit])] = &[ (&[], &[], &[]), (&[], &[ 1], &[ 1]), (&[ 1], &[ 1], &[ 2]), @@ -1085,9 +1085,9 @@ mod biguint_tests { } } - const mul_triples: &static/[(&static/[BigDigit], - &static/[BigDigit], - &static/[BigDigit])] = &[ + const mul_triples: &'static [(&'static [BigDigit], + &'static [BigDigit], + &'static [BigDigit])] = &[ (&[], &[], &[]), (&[], &[ 1], &[]), (&[ 2], &[], &[]), @@ -1111,10 +1111,10 @@ mod biguint_tests { (&[ 0, 0, 1], &[ 0, 0, 0, 1], &[0, 0, 0, 0, 0, 1]) ]; - const divmod_quadruples: &static/[(&static/[BigDigit], - &static/[BigDigit], - &static/[BigDigit], - &static/[BigDigit])] + const divmod_quadruples: &'static [(&'static [BigDigit], + &'static [BigDigit], + &'static [BigDigit], + &'static [BigDigit])] = &[ (&[ 1], &[ 2], &[], &[1]), (&[ 1, 1], &[ 2], &[-1/2+1], &[1]), @@ -1399,9 +1399,9 @@ mod bigint_tests { ).to_uint() == 0); } - const sum_triples: &static/[(&static/[BigDigit], - &static/[BigDigit], - &static/[BigDigit])] = &[ + const sum_triples: &'static [(&'static [BigDigit], + &'static [BigDigit], + &'static [BigDigit])] = &[ (&[], &[], &[]), (&[], &[ 1], &[ 1]), (&[ 1], &[ 1], &[ 2]), @@ -1451,9 +1451,9 @@ mod bigint_tests { } } - const mul_triples: &static/[(&static/[BigDigit], - &static/[BigDigit], - &static/[BigDigit])] = &[ + const mul_triples: &'static [(&'static [BigDigit], + &'static [BigDigit], + &'static [BigDigit])] = &[ (&[], &[], &[]), (&[], &[ 1], &[]), (&[ 2], &[], &[]), @@ -1477,10 +1477,10 @@ mod bigint_tests { (&[ 0, 0, 1], &[ 0, 0, 0, 1], &[0, 0, 0, 0, 0, 1]) ]; - const divmod_quadruples: &static/[(&static/[BigDigit], - &static/[BigDigit], - &static/[BigDigit], - &static/[BigDigit])] + const divmod_quadruples: &'static [(&'static [BigDigit], + &'static [BigDigit], + &'static [BigDigit], + &'static [BigDigit])] = &[ (&[ 1], &[ 2], &[], &[1]), (&[ 1, 1], &[ 2], &[-1/2+1], &[1]), diff --git a/src/libstd/deque.rs b/src/libstd/deque.rs index 15131093acb..90269e28b8a 100644 --- a/src/libstd/deque.rs +++ b/src/libstd/deque.rs @@ -49,17 +49,17 @@ pub impl<T> Deque<T> { /// Return a reference to the first element in the deque /// /// Fails if the deque is empty - fn peek_front(&self) -> &self/T { get(self.elts, self.lo) } + fn peek_front(&self) -> &'self T { get(self.elts, self.lo) } /// Return a reference to the last element in the deque /// /// Fails if the deque is empty - fn peek_back(&self) -> &self/T { get(self.elts, self.hi - 1u) } + fn peek_back(&self) -> &'self T { get(self.elts, self.hi - 1u) } /// Retrieve an element in the deque by index /// /// Fails if there is no element with the given index - fn get(&self, i: int) -> &self/T { + fn get(&self, i: int) -> &'self T { let idx = (self.lo + (i as uint)) % self.elts.len(); get(self.elts, idx) } @@ -130,7 +130,7 @@ fn grow<T>(nelts: uint, lo: uint, elts: &mut [Option<T>]) -> ~[Option<T>] { rv } -fn get<T>(elts: &r/[Option<T>], i: uint) -> &r/T { +fn get<T>(elts: &'r [Option<T>], i: uint) -> &'r T { match elts[i] { Some(ref t) => t, _ => fail!() } } diff --git a/src/libstd/future.rs b/src/libstd/future.rs index 5dc264cb878..4867204ea39 100644 --- a/src/libstd/future.rs +++ b/src/libstd/future.rs @@ -55,7 +55,7 @@ pub impl<A:Copy> Future<A> { pub impl<A> Future<A> { - pure fn get_ref(&self) -> &self/A { + pure fn get_ref(&self) -> &'self A { /*! * Executes the future's closure and then returns a borrowed * pointer to the result. The borrowed pointer lasts as long as diff --git a/src/libstd/json.rs b/src/libstd/json.rs index 56f2611c914..e52d08c40fe 100644 --- a/src/libstd/json.rs +++ b/src/libstd/json.rs @@ -748,7 +748,7 @@ pub fn from_str(s: &str) -> Result<Json, Error> { pub struct Decoder { priv json: Json, - priv mut stack: ~[&self/Json], + priv mut stack: ~[&'self Json], } pub fn Decoder(json: Json) -> Decoder { @@ -756,12 +756,12 @@ pub fn Decoder(json: Json) -> Decoder { } priv impl Decoder/&self { - fn peek(&self) -> &self/Json { + fn peek(&self) -> &'self Json { if self.stack.len() == 0 { self.stack.push(&self.json); } self.stack[self.stack.len() - 1] } - fn pop(&self) -> &self/Json { + fn pop(&self) -> &'self Json { if self.stack.len() == 0 { self.stack.push(&self.json); } self.stack.pop() } diff --git a/src/libstd/priority_queue.rs b/src/libstd/priority_queue.rs index 99d19c4839c..b9b5075c434 100644 --- a/src/libstd/priority_queue.rs +++ b/src/libstd/priority_queue.rs @@ -50,10 +50,10 @@ impl<T:Ord> Mutable for PriorityQueue<T> { pub impl <T:Ord> PriorityQueue<T> { /// Returns the greatest item in the queue - fails if empty - pure fn top(&self) -> &self/T { &self.data[0] } + pure fn top(&self) -> &'self T { &self.data[0] } /// Returns the greatest item in the queue - None if empty - pure fn maybe_top(&self) -> Option<&self/T> { + pure fn maybe_top(&self) -> Option<&'self T> { if self.is_empty() { None } else { Some(self.top()) } } diff --git a/src/libstd/serialize.rs b/src/libstd/serialize.rs index 0288155d29e..2c927b5db16 100644 --- a/src/libstd/serialize.rs +++ b/src/libstd/serialize.rs @@ -213,7 +213,7 @@ impl<D:Decoder> Decodable<D> for i64 { } } -impl<S:Encoder> Encodable<S> for &self/str { +impl<S:Encoder> Encodable<S> for &'self str { fn encode(&self, s: &S) { s.emit_borrowed_str(*self) } } @@ -286,7 +286,7 @@ impl<D:Decoder> Decodable<D> for () { } } -impl<S:Encoder,T:Encodable<S>> Encodable<S> for &self/T { +impl<S:Encoder,T:Encodable<S>> Encodable<S> for &'self T { fn encode(&self, s: &S) { s.emit_borrowed(|| (**self).encode(s)) } @@ -316,7 +316,7 @@ impl<D:Decoder,T:Decodable<D>> Decodable<D> for @T { } } -impl<S:Encoder,T:Encodable<S>> Encodable<S> for &self/[T] { +impl<S:Encoder,T:Encodable<S>> Encodable<S> for &'self [T] { fn encode(&self, s: &S) { do s.emit_borrowed_vec(self.len()) { for self.eachi |i, e| { diff --git a/src/libstd/smallintmap.rs b/src/libstd/smallintmap.rs index bdce257e347..c63ef9b7258 100644 --- a/src/libstd/smallintmap.rs +++ b/src/libstd/smallintmap.rs @@ -22,9 +22,9 @@ pub struct SmallIntMap<T> { priv v: ~[Option<T>], } -impl<V> BaseIter<(uint, &self/V)> for SmallIntMap<V> { +impl<V> BaseIter<(uint, &'self V)> for SmallIntMap<V> { /// Visit all key-value pairs in order - pure fn each(&self, it: &fn(&(uint, &self/V)) -> bool) { + pure fn each(&self, it: &fn(&(uint, &'self V)) -> bool) { for uint::range(0, self.v.len()) |i| { match self.v[i] { Some(ref elt) => if !it(&(i, elt)) { break }, @@ -36,9 +36,9 @@ impl<V> BaseIter<(uint, &self/V)> for SmallIntMap<V> { pure fn size_hint(&self) -> Option<uint> { Some(self.len()) } } -impl<V> ReverseIter<(uint, &self/V)> for SmallIntMap<V> { +impl<V> ReverseIter<(uint, &'self V)> for SmallIntMap<V> { /// Visit all key-value pairs in reverse order - pure fn each_reverse(&self, it: &fn(&(uint, &self/V)) -> bool) { + pure fn each_reverse(&self, it: &fn(&(uint, &'self V)) -> bool) { for uint::range_rev(self.v.len(), 0) |i| { match self.v[i - 1] { Some(ref elt) => if !it(&(i - 1, elt)) { break }, @@ -96,7 +96,7 @@ impl<V> Map<uint, V> for SmallIntMap<V> { } /// Iterate over the map and mutate the contained values - pure fn find(&self, key: &uint) -> Option<&self/V> { + pure fn find(&self, key: &uint) -> Option<&'self V> { if *key < self.v.len() { match self.v[*key] { Some(ref value) => Some(value), @@ -136,7 +136,7 @@ pub impl<V> SmallIntMap<V> { /// Create an empty SmallIntMap static pure fn new() -> SmallIntMap<V> { SmallIntMap{v: ~[]} } - pure fn get(&self, key: &uint) -> &self/V { + pure fn get(&self, key: &uint) -> &'self V { self.find(key).expect("key not present") } } diff --git a/src/libstd/sort.rs b/src/libstd/sort.rs index e0828d981d7..43c68196eb8 100644 --- a/src/libstd/sort.rs +++ b/src/libstd/sort.rs @@ -16,7 +16,7 @@ use core::util; use core::vec::{len, push}; use core::vec; -type Le<T> = &self/pure fn(v1: &T, v2: &T) -> bool; +type Le<T> = &'self pure fn(v1: &T, v2: &T) -> bool; /** * Merge sort. Returns a new vector containing the sorted list. @@ -168,7 +168,7 @@ pub trait Sort { fn qsort(self); } -impl<T:Copy + Ord + Eq> Sort for &self/mut [T] { +impl<T:Copy + Ord + Eq> Sort for &'self mut [T] { fn qsort(self) { quick_sort3(self); } } @@ -868,7 +868,7 @@ mod tests { #[test] pub fn test_merge_sort_stability() { // tjc: funny that we have to use parens - pure fn ile(x: &(&static/str), y: &(&static/str)) -> bool + pure fn ile(x: &(&'static str), y: &(&'static str)) -> bool { unsafe // to_lower is not pure... { @@ -1172,7 +1172,7 @@ mod big_tests { struct LVal { val: uint, - key: &self/fn(@uint), + key: &'self fn(@uint), } impl Drop for LVal/&self { @@ -1190,16 +1190,16 @@ mod big_tests { } impl Ord for LVal/&self { - pure fn lt(&self, other: &a/LVal/&self) -> bool { + pure fn lt(&self, other: &'a LVal/&self) -> bool { (*self).val < other.val } - pure fn le(&self, other: &a/LVal/&self) -> bool { + pure fn le(&self, other: &'a LVal/&self) -> bool { (*self).val <= other.val } - pure fn gt(&self, other: &a/LVal/&self) -> bool { + pure fn gt(&self, other: &'a LVal/&self) -> bool { (*self).val > other.val } - pure fn ge(&self, other: &a/LVal/&self) -> bool { + pure fn ge(&self, other: &'a LVal/&self) -> bool { (*self).val >= other.val } } diff --git a/src/libstd/stats.rs b/src/libstd/stats.rs index 2a62ebadd2b..cecf9686327 100644 --- a/src/libstd/stats.rs +++ b/src/libstd/stats.rs @@ -30,7 +30,7 @@ pub trait Stats { fn median_abs_dev_pct(self) -> f64; } -impl Stats for &self/[f64] { +impl Stats for &'self [f64] { fn sum(self) -> f64 { vec::foldl(0.0, self, |p,q| p + *q) } diff --git a/src/libstd/sync.rs b/src/libstd/sync.rs index 1d1ec0e11f7..d556be6b85b 100644 --- a/src/libstd/sync.rs +++ b/src/libstd/sync.rs @@ -165,7 +165,7 @@ pub impl Sem<~[Waitqueue]> { #[doc(hidden)] type SemRelease = SemReleaseGeneric/&self<()>; type SemAndSignalRelease = SemReleaseGeneric/&self<~[Waitqueue]>; -struct SemReleaseGeneric<Q> { sem: &self/Sem<Q> } +struct SemReleaseGeneric<Q> { sem: &'self Sem<Q> } impl<Q:Owned> Drop for SemReleaseGeneric/&self<Q> { fn finalize(&self) { @@ -173,13 +173,13 @@ impl<Q:Owned> Drop for SemReleaseGeneric/&self<Q> { } } -fn SemRelease(sem: &r/Sem<()>) -> SemRelease/&r { +fn SemRelease(sem: &'r Sem<()>) -> SemRelease/&r { SemReleaseGeneric { sem: sem } } -fn SemAndSignalRelease(sem: &r/Sem<~[Waitqueue]>) +fn SemAndSignalRelease(sem: &'r Sem<~[Waitqueue]>) -> SemAndSignalRelease/&r { SemReleaseGeneric { sem: sem @@ -187,7 +187,7 @@ fn SemAndSignalRelease(sem: &r/Sem<~[Waitqueue]>) } /// A mechanism for atomic-unlock-and-deschedule blocking and signalling. -pub struct Condvar { priv sem: &self/Sem<~[Waitqueue]> } +pub struct Condvar { priv sem: &'self Sem<~[Waitqueue]> } impl Drop for Condvar/&self { fn finalize(&self) {} } @@ -258,7 +258,7 @@ pub impl Condvar/&self { // mutex during unwinding. As long as the wrapper (mutex, etc) is // bounded in when it gets released, this shouldn't hang forever. struct SemAndSignalReacquire { - sem: &self/Sem<~[Waitqueue]>, + sem: &'self Sem<~[Waitqueue]>, } impl Drop for SemAndSignalReacquire/&self { @@ -272,7 +272,7 @@ pub impl Condvar/&self { } } - fn SemAndSignalReacquire(sem: &r/Sem<~[Waitqueue]>) + fn SemAndSignalReacquire(sem: &'r Sem<~[Waitqueue]>) -> SemAndSignalReacquire/&r { SemAndSignalReacquire { sem: sem @@ -610,7 +610,7 @@ pub impl RWlock { // FIXME(#3588) should go inside of read() #[doc(hidden)] struct RWlockReleaseRead { - lock: &self/RWlock, + lock: &'self RWlock, } impl Drop for RWlockReleaseRead/&self { @@ -635,7 +635,7 @@ impl Drop for RWlockReleaseRead/&self { } } -fn RWlockReleaseRead(lock: &r/RWlock) -> RWlockReleaseRead/&r { +fn RWlockReleaseRead(lock: &'r RWlock) -> RWlockReleaseRead/&r { RWlockReleaseRead { lock: lock } @@ -644,7 +644,7 @@ fn RWlockReleaseRead(lock: &r/RWlock) -> RWlockReleaseRead/&r { // FIXME(#3588) should go inside of downgrade() #[doc(hidden)] struct RWlockReleaseDowngrade { - lock: &self/RWlock, + lock: &'self RWlock, } impl Drop for RWlockReleaseDowngrade/&self { @@ -677,18 +677,18 @@ impl Drop for RWlockReleaseDowngrade/&self { } } -fn RWlockReleaseDowngrade(lock: &r/RWlock) -> RWlockReleaseDowngrade/&r { +fn RWlockReleaseDowngrade(lock: &'r RWlock) -> RWlockReleaseDowngrade/&r { RWlockReleaseDowngrade { lock: lock } } /// The "write permission" token used for rwlock.write_downgrade(). -pub struct RWlockWriteMode { priv lock: &self/RWlock } +pub struct RWlockWriteMode { priv lock: &'self RWlock } impl Drop for RWlockWriteMode/&self { fn finalize(&self) {} } /// The "read permission" token used for rwlock.write_downgrade(). -pub struct RWlockReadMode { priv lock: &self/RWlock } +pub struct RWlockReadMode { priv lock: &'self RWlock } impl Drop for RWlockReadMode/&self { fn finalize(&self) {} } pub impl RWlockWriteMode/&self { diff --git a/src/libstd/test.rs b/src/libstd/test.rs index cec9f56708f..63cf4c998df 100644 --- a/src/libstd/test.rs +++ b/src/libstd/test.rs @@ -49,7 +49,7 @@ pub mod rustrt { // hierarchically it may. pub enum TestName { - StaticTestName(&static/str), + StaticTestName(&'static str), DynTestName(~str) } impl ToStr for TestName { diff --git a/src/libstd/treemap.rs b/src/libstd/treemap.rs index 8e204014975..7192da7b88e 100644 --- a/src/libstd/treemap.rs +++ b/src/libstd/treemap.rs @@ -88,7 +88,7 @@ impl<K: Ord + TotalOrd, V> Ord for TreeMap<K, V> { impl<'self, K: TotalOrd, V> BaseIter<(&'self K, &'self V)> for TreeMap<K, V> { /// Visit all key-value pairs in order - pure fn each(&self, f: &fn(&(&self/K, &self/V)) -> bool) { + pure fn each(&self, f: &fn(&(&'self K, &'self V)) -> bool) { each(&self.root, f) } pure fn size_hint(&self) -> Option<uint> { Some(self.len()) } @@ -99,7 +99,7 @@ impl<'self, K: TotalOrd, V> for TreeMap<K, V> { /// Visit all key-value pairs in reverse order - pure fn each_reverse(&self, f: &fn(&(&self/K, &self/V)) -> bool) { + pure fn each_reverse(&self, f: &fn(&(&'self K, &'self V)) -> bool) { each_reverse(&self.root, f); } } @@ -140,8 +140,8 @@ impl<K: TotalOrd, V> Map<K, V> for TreeMap<K, V> { } /// Return the value corresponding to the key in the map - pure fn find(&self, key: &K) -> Option<&self/V> { - let mut current: &self/Option<~TreeNode<K, V>> = &self.root; + pure fn find(&self, key: &K) -> Option<&'self V> { + let mut current: &'self Option<~TreeNode<K, V>> = &self.root; loop { match *current { Some(ref r) => { @@ -197,15 +197,15 @@ pub impl<K: TotalOrd, V> TreeMap<K, V> { /// Lazy forward iterator over a map pub struct TreeMapIterator<K, V> { - priv stack: ~[&self/~TreeNode<K, V>], - priv node: &self/Option<~TreeNode<K, V>> + priv stack: ~[&'self ~TreeNode<K, V>], + priv node: &'self Option<~TreeNode<K, V>> } /// Advance the iterator to the next node (in order) and return a /// tuple with a reference to the key and value. If there are no /// more nodes, return `None`. pub fn map_next<K, V>(iter: &mut TreeMapIterator/&r<K, V>) - -> Option<(&r/K, &r/V)> { + -> Option<(&'r K, &'r V)> { while !iter.stack.is_empty() || iter.node.is_some() { match *iter.node { Some(ref x) => { @@ -224,7 +224,7 @@ pub fn map_next<K, V>(iter: &mut TreeMapIterator/&r<K, V>) /// Advance the iterator through the map pub fn map_advance<K, V>(iter: &mut TreeMapIterator/&r<K, V>, - f: &fn((&r/K, &r/V)) -> bool) { + f: &fn((&'r K, &'r V)) -> bool) { loop { match map_next(iter) { Some(x) => { @@ -519,14 +519,14 @@ pub struct TreeSetIterator<T> { /// Advance the iterator to the next node (in order). If this iterator is /// finished, does nothing. #[inline(always)] -pub fn set_next<T>(iter: &mut TreeSetIterator/&r<T>) -> Option<&r/T> { +pub fn set_next<T>(iter: &mut TreeSetIterator/&r<T>) -> Option<&'r T> { do map_next(&mut iter.iter).map |&(value, _)| { value } } /// Advance the iterator through the set #[inline(always)] pub fn set_advance<T>(iter: &mut TreeSetIterator/&r<T>, - f: &fn(&r/T) -> bool) { + f: &fn(&'r T) -> bool) { do map_advance(&mut iter.iter) |(k, _)| { f(k) } } @@ -547,16 +547,16 @@ pub impl<K: TotalOrd, V> TreeNode<K, V> { } } -pure fn each<K: TotalOrd, V>(node: &r/Option<~TreeNode<K, V>>, - f: &fn(&(&r/K, &r/V)) -> bool) { +pure fn each<K: TotalOrd, V>(node: &'r Option<~TreeNode<K, V>>, + f: &fn(&(&'r K, &'r V)) -> bool) { for node.each |x| { each(&x.left, f); if f(&(&x.key, &x.value)) { each(&x.right, f) } } } -pure fn each_reverse<K: TotalOrd, V>(node: &r/Option<~TreeNode<K, V>>, - f: &fn(&(&r/K, &r/V)) -> bool) { +pure fn each_reverse<K: TotalOrd, V>(node: &'r Option<~TreeNode<K, V>>, + f: &fn(&(&'r K, &'r V)) -> bool) { for node.each |x| { each_reverse(&x.right, f); if f(&(&x.key, &x.value)) { each_reverse(&x.left, f) } |
