diff options
| author | Marijn Haverbeke <marijnh@gmail.com> | 2012-03-19 10:45:29 +0100 |
|---|---|---|
| committer | Marijn Haverbeke <marijnh@gmail.com> | 2012-03-19 10:45:29 +0100 |
| commit | cec1a9b8592b573e40d81ba52d658bdcd9acacb3 (patch) | |
| tree | df516375ee85683a7af3fb7abef20242a0e64beb /src/libstd | |
| parent | 4c4ac05f02aeba7d0abd421e9a19d1b4083018d6 (diff) | |
| download | rust-cec1a9b8592b573e40d81ba52d658bdcd9acacb3.tar.gz rust-cec1a9b8592b573e40d81ba52d658bdcd9acacb3.zip | |
Properly check kinds when instantiating types
Closes #2011
Diffstat (limited to 'src/libstd')
| -rw-r--r-- | src/libstd/smallintmap.rs | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/libstd/smallintmap.rs b/src/libstd/smallintmap.rs index e90fb1abd96..d58e0519387 100644 --- a/src/libstd/smallintmap.rs +++ b/src/libstd/smallintmap.rs @@ -7,10 +7,10 @@ import core::option::{some, none}; // FIXME: Should not be @; there's a bug somewhere in rustc that requires this // to be. -type smallintmap<T> = @{mutable v: [mutable option<T>]}; +type smallintmap<T: copy> = @{mutable v: [mutable option<T>]}; #[doc = "Create a smallintmap"] -fn mk<T>() -> smallintmap<T> { +fn mk<T: copy>() -> smallintmap<T> { let v: [mutable option<T>] = [mutable]; ret @{mutable v: v}; } @@ -59,7 +59,7 @@ fn truncate<T: copy>(m: smallintmap<T>, len: uint) { m.v = vec::to_mut(vec::slice::<option<T>>(m.v, 0u, len)); } -fn max_key<T>(m: smallintmap<T>) -> uint { +fn max_key<T: copy>(m: smallintmap<T>) -> uint { ret vec::len::<option<T>>(m.v); } @@ -116,6 +116,6 @@ impl <V: copy> of map::map<uint, V> for smallintmap<V> { } #[doc = "Cast the given smallintmap to a map::map"] -fn as_map<V>(s: smallintmap<V>) -> map::map<uint, V> { +fn as_map<V: copy>(s: smallintmap<V>) -> map::map<uint, V> { s as map::map::<uint, V> } |
