diff options
| author | Marijn Haverbeke <marijnh@gmail.com> | 2011-11-18 12:39:20 +0100 |
|---|---|---|
| committer | Marijn Haverbeke <marijnh@gmail.com> | 2011-11-18 12:49:01 +0100 |
| commit | f6491bb42636f4c43f3cbb48fdb98ddd749e6e5d (patch) | |
| tree | c22607ada38b85ce4fadda6cf89998f6684a4964 /src/comp/syntax/util | |
| parent | 8f8ebb550cf7e641d7dedd56e08efd4f0e15afab (diff) | |
Update stdlib, compiler, and tests to new kind system
This involved adding 'copy' to more generics than I hoped, but an experiment with making it implicit showed that that way lies madness -- unless enforced, you will not remember to mark functions that don't copy as not requiring copyable kind. Issue #1177
Diffstat (limited to 'src/comp/syntax/util')
| -rw-r--r-- | src/comp/syntax/util/interner.rs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/comp/syntax/util/interner.rs b/src/comp/syntax/util/interner.rs index c814f168a4a..6993eeee35e 100644 --- a/src/comp/syntax/util/interner.rs +++ b/src/comp/syntax/util/interner.rs @@ -11,12 +11,12 @@ type interner<T> = hasher: hashfn<T>, eqer: eqfn<T>}; -fn mk<T>(hasher: hashfn<T>, eqer: eqfn<T>) -> interner<T> { +fn mk<copy T>(hasher: hashfn<T>, eqer: eqfn<T>) -> interner<T> { let m = map::mk_hashmap::<T, uint>(hasher, eqer); ret {map: m, mutable vect: [], hasher: hasher, eqer: eqer}; } -fn intern<T>(itr: interner<T>, val: T) -> uint { +fn intern<copy T>(itr: interner<T>, val: T) -> uint { alt itr.map.find(val) { some(idx) { ret idx; } none. { @@ -31,7 +31,7 @@ fn intern<T>(itr: interner<T>, val: T) -> uint { // |get| isn't "pure" in the traditional sense, because it can go from // failing to returning a value as items are interned. But for typestate, // where we first check a pred and then rely on it, ceasing to fail is ok. -pure fn get<T>(itr: interner<T>, idx: uint) -> T { +pure fn get<copy T>(itr: interner<T>, idx: uint) -> T { unchecked { itr.vect[idx] } |
