diff options
| author | Niko Matsakis <niko@alum.mit.edu> | 2012-08-21 08:10:32 -0700 |
|---|---|---|
| committer | Niko Matsakis <niko@alum.mit.edu> | 2012-08-21 16:07:53 -0700 |
| commit | 182814ef8191e2b153806380f8d3d46069c69a8d (patch) | |
| tree | 7093f34155aadeb5e8158d6207aad3cd7462d194 /src/libcore | |
| parent | 9440f8e9b86de3c6166a875b8aee29448580e7ea (diff) | |
remove some FIXMEd code as the relevant issue is fixed
Diffstat (limited to 'src/libcore')
| -rw-r--r-- | src/libcore/send_map.rs | 29 |
1 files changed, 15 insertions, 14 deletions
diff --git a/src/libcore/send_map.rs b/src/libcore/send_map.rs index cb8d596cf88..52a63dacbfc 100644 --- a/src/libcore/send_map.rs +++ b/src/libcore/send_map.rs @@ -58,12 +58,6 @@ mod linear { buckets: vec::from_fn(initial_capacity, |_i| none)}) } - // FIXME(#2979) would allow us to use region type for k - unsafe fn borrow<K>(&&k: K) -> &K { - let p: *K = ptr::addr_of(k); - unsafe::reinterpret_cast(p) - } - priv impl<K, V> &const LinearMap<K,V> { #[inline(always)] pure fn to_bucket(h: uint) -> uint { @@ -155,8 +149,7 @@ mod linear { /// Assumes that there will be a bucket. /// True if there was no previous entry with that key fn insert_internal(hash: uint, +k: K, +v: V) -> bool { - match self.bucket_for_key_with_hash(self.buckets, hash, - unsafe{borrow(k)}) { + match self.bucket_for_key_with_hash(self.buckets, hash, &k) { TableFull => {fail ~"Internal logic error";} FoundHole(idx) => { debug!{"insert fresh (%?->%?) at idx %?, hash %?", @@ -187,7 +180,7 @@ mod linear { self.expand(); } - let hash = self.hashfn(unsafe{borrow(k)}); + let hash = self.hashfn(&k); self.insert_internal(hash, k, v) } @@ -279,11 +272,19 @@ mod linear { impl<K,V> &LinearMap<K,V> { /* - FIXME --- #2979 must be fixed to typecheck this - fn find_ptr(k: K) -> option<&V> { - //XXX this should not type check as written, but it should - //be *possible* to typecheck it... - self.with_ptr(k, |v| v) + FIXME(#3148)--region inference fails to capture needed deps + + fn find_ref(k: &K) -> option<&self/V> { + match self.bucket_for_key(self.buckets, k) { + FoundEntry(idx) => { + match check self.buckets[idx] { + some(ref bkt) => some(&bkt.value) + } + } + TableFull | FoundHole(_) => { + none + } + } } */ |
