diff options
| author | bors <bors@rust-lang.org> | 2013-07-20 10:55:34 -0700 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2013-07-20 10:55:34 -0700 |
| commit | 5c999d4ecac0b4fb4b64c3e174f89bb5165abfd3 (patch) | |
| tree | 4b39e15a052cec1cd0fb69fb911a7b7ca0641c59 /src/libextra | |
| parent | 8aae6edce09a8e2a32a154acb55c9879dbebf99c (diff) | |
| parent | 9089cf2ec9297a3b558d24352cde6a5206a08444 (diff) | |
| download | rust-5c999d4ecac0b4fb4b64c3e174f89bb5165abfd3.tar.gz rust-5c999d4ecac0b4fb4b64c3e174f89bb5165abfd3.zip | |
auto merge of #7894 : pcwalton/rust/and-pointers-in-at-boxes, r=brson
r? @brson
Diffstat (limited to 'src/libextra')
| -rw-r--r-- | src/libextra/fun_treemap.rs | 17 | ||||
| -rw-r--r-- | src/libextra/list.rs | 4 | ||||
| -rw-r--r-- | src/libextra/serialize.rs | 4 |
3 files changed, 18 insertions, 7 deletions
diff --git a/src/libextra/fun_treemap.rs b/src/libextra/fun_treemap.rs index 7074d76536a..edbe323ec2d 100644 --- a/src/libextra/fun_treemap.rs +++ b/src/libextra/fun_treemap.rs @@ -31,10 +31,17 @@ enum TreeNode<K, V> { } /// Create a treemap -pub fn init<K, V>() -> Treemap<K, V> { @Empty } +pub fn init<K: 'static, V: 'static>() -> Treemap<K, V> { + @Empty +} /// Insert a value into the map -pub fn insert<K:Eq + Ord,V>(m: Treemap<K, V>, k: K, v: V) -> Treemap<K, V> { +pub fn insert<K:Eq + Ord + 'static, + V:'static>( + m: Treemap<K, V>, + k: K, + v: V) + -> Treemap<K, V> { @match m { @Empty => Node(@k, @v, @Empty, @Empty), @Node(kk, vv, left, right) => cond!( @@ -46,7 +53,11 @@ pub fn insert<K:Eq + Ord,V>(m: Treemap<K, V>, k: K, v: V) -> Treemap<K, V> { } /// Find a value based on the key -pub fn find<K:Eq + Ord,V:Clone>(m: Treemap<K, V>, k: K) -> Option<V> { +pub fn find<K:Eq + Ord + 'static, + V:Clone + 'static>( + m: Treemap<K, V>, + k: K) + -> Option<V> { match *m { Empty => None, Node(kk, v, left, right) => cond!( diff --git a/src/libextra/list.rs b/src/libextra/list.rs index 03481760579..8f7ade7228b 100644 --- a/src/libextra/list.rs +++ b/src/libextra/list.rs @@ -25,7 +25,7 @@ pub enum MutList<T> { } /// Create a list from a vector -pub fn from_vec<T:Clone>(v: &[T]) -> @List<T> { +pub fn from_vec<T:Clone + 'static>(v: &[T]) -> @List<T> { v.rev_iter().fold(@Nil::<T>, |t, h| @Cons((*h).clone(), t)) } @@ -109,7 +109,7 @@ pub fn head<T:Clone>(ls: @List<T>) -> T { } /// Appends one list to another -pub fn append<T:Clone>(l: @List<T>, m: @List<T>) -> @List<T> { +pub fn append<T:Clone + 'static>(l: @List<T>, m: @List<T>) -> @List<T> { match *l { Nil => return m, Cons(ref x, xs) => { diff --git a/src/libextra/serialize.rs b/src/libextra/serialize.rs index 62c1f6631d2..679e5e46547 100644 --- a/src/libextra/serialize.rs +++ b/src/libextra/serialize.rs @@ -423,7 +423,7 @@ impl<S:Encoder,T:Encodable<S>> Encodable<S> for @T { } } -impl<D:Decoder,T:Decodable<D>> Decodable<D> for @T { +impl<D:Decoder,T:Decodable<D> + 'static> Decodable<D> for @T { fn decode(d: &mut D) -> @T { @Decodable::decode(d) } @@ -435,7 +435,7 @@ impl<S:Encoder,T:Encodable<S>> Encodable<S> for @mut T { } } -impl<D:Decoder,T:Decodable<D>> Decodable<D> for @mut T { +impl<D:Decoder,T:Decodable<D> + 'static> Decodable<D> for @mut T { fn decode(d: &mut D) -> @mut T { @mut Decodable::decode(d) } |
