Skip to content

Commit 43865e0

Browse files
committed
---
yaml --- r: 27938 b: refs/heads/try c: 182814e h: refs/heads/master v: v3
1 parent 0b0f07f commit 43865e0

File tree

2 files changed

+16
-15
lines changed

2 files changed

+16
-15
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
refs/heads/master: cd6f24f9d14ac90d167386a56e7a6ac1f0318195
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: cd6f24f9d14ac90d167386a56e7a6ac1f0318195
5-
refs/heads/try: 9440f8e9b86de3c6166a875b8aee29448580e7ea
5+
refs/heads/try: 182814ef8191e2b153806380f8d3d46069c69a8d
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: d0c6ce338884ee21843f4b40bf6bf18d222ce5df

branches/try/src/libcore/send_map.rs

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -58,12 +58,6 @@ mod linear {
5858
buckets: vec::from_fn(initial_capacity, |_i| none)})
5959
}
6060

61-
// FIXME(#2979) would allow us to use region type for k
62-
unsafe fn borrow<K>(&&k: K) -> &K {
63-
let p: *K = ptr::addr_of(k);
64-
unsafe::reinterpret_cast(p)
65-
}
66-
6761
priv impl<K, V> &const LinearMap<K,V> {
6862
#[inline(always)]
6963
pure fn to_bucket(h: uint) -> uint {
@@ -155,8 +149,7 @@ mod linear {
155149
/// Assumes that there will be a bucket.
156150
/// True if there was no previous entry with that key
157151
fn insert_internal(hash: uint, +k: K, +v: V) -> bool {
158-
match self.bucket_for_key_with_hash(self.buckets, hash,
159-
unsafe{borrow(k)}) {
152+
match self.bucket_for_key_with_hash(self.buckets, hash, &k) {
160153
TableFull => {fail ~"Internal logic error";}
161154
FoundHole(idx) => {
162155
debug!{"insert fresh (%?->%?) at idx %?, hash %?",
@@ -187,7 +180,7 @@ mod linear {
187180
self.expand();
188181
}
189182

190-
let hash = self.hashfn(unsafe{borrow(k)});
183+
let hash = self.hashfn(&k);
191184
self.insert_internal(hash, k, v)
192185
}
193186

@@ -279,11 +272,19 @@ mod linear {
279272

280273
impl<K,V> &LinearMap<K,V> {
281274
/*
282-
FIXME --- #2979 must be fixed to typecheck this
283-
fn find_ptr(k: K) -> option<&V> {
284-
//XXX this should not type check as written, but it should
285-
//be *possible* to typecheck it...
286-
self.with_ptr(k, |v| v)
275+
FIXME(#3148)--region inference fails to capture needed deps
276+
277+
fn find_ref(k: &K) -> option<&self/V> {
278+
match self.bucket_for_key(self.buckets, k) {
279+
FoundEntry(idx) => {
280+
match check self.buckets[idx] {
281+
some(ref bkt) => some(&bkt.value)
282+
}
283+
}
284+
TableFull | FoundHole(_) => {
285+
none
286+
}
287+
}
287288
}
288289
*/
289290

0 commit comments

Comments
 (0)