diff options
| author | Patrick Walton <pcwalton@mimiga.net> | 2011-07-06 11:26:26 -0700 |
|---|---|---|
| committer | Patrick Walton <pcwalton@mimiga.net> | 2011-07-06 11:26:26 -0700 |
| commit | bbdba21b1f3c7dfc4c0bac3525cc35939ae8ca4c (patch) | |
| tree | d9cb0046b2a608b4b44c54eacce7951326c65df2 /src/comp/syntax/util | |
| parent | ec890fff23d80da97086e89f29ef7f8d14dbaab8 (diff) | |
| download | rust-bbdba21b1f3c7dfc4c0bac3525cc35939ae8ca4c.tar.gz rust-bbdba21b1f3c7dfc4c0bac3525cc35939ae8ca4c.zip | |
rustc: Revert the conversion to interior vectors due to heap corruption
Diffstat (limited to 'src/comp/syntax/util')
| -rw-r--r-- | src/comp/syntax/util/interner.rs | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/comp/syntax/util/interner.rs b/src/comp/syntax/util/interner.rs index 9717e30d6e6..e096b953a89 100644 --- a/src/comp/syntax/util/interner.rs +++ b/src/comp/syntax/util/interner.rs @@ -1,7 +1,7 @@ // An "interner" is a data structure that associates values with uint tags and // allows bidirectional lookup; i.e. given a value, one can easily find the // type, and vice versa. -import std::ivec; +import std::vec; import std::map; import std::map::hashmap; import std::map::hashfn; @@ -12,24 +12,24 @@ import std::option::some; type interner[T] = rec(hashmap[T, uint] map, - mutable T[] vect, + mutable vec[T] vect, hashfn[T] hasher, eqfn[T] eqer); fn mk[T](hashfn[T] hasher, eqfn[T] eqer) -> interner[T] { auto m = map::mk_hashmap[T, uint](hasher, eqer); - ret rec(map=m, mutable vect=~[], hasher=hasher, eqer=eqer); + let vec[T] vect = []; + ret rec(map=m, mutable vect=vect, hasher=hasher, eqer=eqer); } fn intern[T](&interner[T] itr, &T val) -> uint { alt (itr.map.find(val)) { case (some(?idx)) { ret idx; } case (none) { - auto new_idx = ivec::len[T](itr.vect); + auto new_idx = vec::len[T](itr.vect); itr.map.insert(val, new_idx); - itr.vect += ~[val]; + itr.vect += [val]; ret new_idx; } } } fn get[T](&interner[T] itr, uint idx) -> T { ret itr.vect.(idx); } - |
