@@ -184,18 +184,6 @@ priv impl<K:Hash + Eq,V> HashMap<K, V> {
184184 }
185185 }
186186
187- #[ cfg( stage0) ]
188- #[ inline( always) ]
189- fn value_for_bucket ( & self , idx : uint ) -> & ' self V {
190- match self . buckets [ idx] {
191- Some ( ref bkt) => & bkt. value ,
192- None => fail ! ( ~"HashMap :: find: internal logic error"),
193- }
194- }
195-
196- #[cfg(stage1)]
197- #[cfg(stage2)]
198- #[cfg(stage3)]
199187 #[ inline( always) ]
200188 fn value_for_bucket < ' a > ( & ' a self , idx : uint ) -> & ' a V {
201189 match self . buckets [ idx] {
@@ -204,18 +192,6 @@ priv impl<K:Hash + Eq,V> HashMap<K, V> {
204192 }
205193 }
206194
207- #[cfg(stage0)]
208- #[inline(always)]
209- fn mut_value_for_bucket(&mut self, idx: uint) -> &'self mut V {
210- match self.buckets[idx] {
211- Some(ref mut bkt) => &mut bkt.value,
212- None => unreachable()
213- }
214- }
215-
216- #[cfg(stage1)]
217- #[cfg(stage2)]
218- #[cfg(stage3)]
219195 #[inline(always)]
220196 fn mut_value_for_bucket<'a>(&'a mut self, idx: uint) -> &'a mut V {
221197 match self.buckets[idx] {
@@ -329,21 +305,6 @@ impl<K:Hash + Eq,V> Map<K, V> for HashMap<K, V> {
329305 }
330306
331307 /// Visit all key-value pairs
332- #[cfg(stage0)]
333- fn each(&self, blk: &fn(&'self K, &'self V) -> bool) {
334- for uint::range(0, self.buckets.len()) |i| {
335- for self.buckets[i].each |bucket| {
336- if !blk(&bucket.key, &bucket.value) {
337- return;
338- }
339- }
340- }
341- }
342-
343- /// Visit all key-value pairs
344- #[cfg(stage1)]
345- #[cfg(stage2)]
346- #[cfg(stage3)]
347308 fn each<'a>(&'a self, blk: &fn(&'a K, &'a V) -> bool) {
348309 for uint::range(0, self.buckets.len()) |i| {
349310 for self.buckets[i].each |bucket| {
@@ -360,15 +321,6 @@ impl<K:Hash + Eq,V> Map<K, V> for HashMap<K, V> {
360321 }
361322
362323 /// Visit all values
363- #[cfg(stage0)]
364- fn each_value(&self, blk: &fn(v: &V) -> bool) {
365- self.each(|_, v| blk(v))
366- }
367-
368- /// Visit all values
369- #[cfg(stage1)]
370- #[cfg(stage2)]
371- #[cfg(stage3)]
372324 fn each_value<'a>(&'a self, blk: &fn(v: &'a V) -> bool) {
373325 self.each(|_, v| blk(v))
374326 }
@@ -386,18 +338,6 @@ impl<K:Hash + Eq,V> Map<K, V> for HashMap<K, V> {
386338 }
387339
388340 /// Return a reference to the value corresponding to the key
389- #[cfg(stage0)]
390- fn find(&self, k: &K) -> Option<&'self V> {
391- match self.bucket_for_key(k) {
392- FoundEntry(idx) => Some(self.value_for_bucket(idx)),
393- TableFull | FoundHole(_) => None,
394- }
395- }
396-
397- /// Return a reference to the value corresponding to the key
398- #[cfg(stage1)]
399- #[cfg(stage2)]
400- #[cfg(stage3)]
401341 fn find<'a>(&'a self, k: &K) -> Option<&'a V> {
402342 match self.bucket_for_key(k) {
403343 FoundEntry(idx) => Some(self.value_for_bucket(idx)),
@@ -406,21 +346,6 @@ impl<K:Hash + Eq,V> Map<K, V> for HashMap<K, V> {
406346 }
407347
408348 /// Return a mutable reference to the value corresponding to the key
409- #[cfg(stage0)]
410- fn find_mut(&mut self, k: &K) -> Option<&'self mut V> {
411- let idx = match self.bucket_for_key(k) {
412- FoundEntry(idx) => idx,
413- TableFull | FoundHole(_) => return None
414- };
415- unsafe { // FIXME(#4903)---requires flow-sensitive borrow checker
416- Some(::cast::transmute_mut_region(self.mut_value_for_bucket(idx)))
417- }
418- }
419-
420- /// Return a mutable reference to the value corresponding to the key
421- #[cfg(stage1)]
422- #[cfg(stage2)]
423- #[cfg(stage3)]
424349 fn find_mut<'a>(&'a mut self, k: &K) -> Option<&'a mut V> {
425350 let idx = match self.bucket_for_key(k) {
426351 FoundEntry(idx) => idx,
@@ -503,40 +428,6 @@ pub impl<K: Hash + Eq, V> HashMap<K, V> {
503428
504429 /// Return the value corresponding to the key in the map, or insert
505430 /// and return the value if it doesn't exist.
506- #[cfg(stage0)]
507- fn find_or_insert(&mut self, k: K, v: V) -> &'self V {
508- if self.size >= self.resize_at {
509- // n.b.: We could also do this after searching, so
510- // that we do not resize if this call to insert is
511- // simply going to update a key in place. My sense
512- // though is that it's worse to have to search through
513- // buckets to find the right spot twice than to just
514- // resize in this corner case.
515- self.expand();
516- }
517-
518- let hash = k.hash_keyed(self.k0, self.k1) as uint;
519- let idx = match self.bucket_for_key_with_hash(hash, &k) {
520- TableFull => fail!(~" Internal logic error"),
521- FoundEntry(idx) => idx,
522- FoundHole(idx) => {
523- self.buckets[idx] = Some(Bucket{hash: hash, key: k,
524- value: v});
525- self.size += 1;
526- idx
527- },
528- };
529-
530- unsafe { // FIXME(#4903)---requires flow-sensitive borrow checker
531- ::cast::transmute_region(self.value_for_bucket(idx))
532- }
533- }
534-
535- /// Return the value corresponding to the key in the map, or insert
536- /// and return the value if it doesn't exist.
537- #[cfg(stage1)]
538- #[cfg(stage2)]
539- #[cfg(stage3)]
540431 fn find_or_insert<'a>(&'a mut self, k: K, v: V) -> &'a V {
541432 if self.size >= self.resize_at {
542433 // n.b.: We could also do this after searching, so
@@ -567,41 +458,6 @@ pub impl<K: Hash + Eq, V> HashMap<K, V> {
567458
568459 /// Return the value corresponding to the key in the map, or create,
569460 /// insert, and return a new value if it doesn't exist.
570- #[cfg(stage0)]
571- fn find_or_insert_with(&mut self, k: K, f: &fn(&K) -> V) -> &'self V {
572- if self.size >= self.resize_at {
573- // n.b.: We could also do this after searching, so
574- // that we do not resize if this call to insert is
575- // simply going to update a key in place. My sense
576- // though is that it's worse to have to search through
577- // buckets to find the right spot twice than to just
578- // resize in this corner case.
579- self.expand();
580- }
581-
582- let hash = k.hash_keyed(self.k0, self.k1) as uint;
583- let idx = match self.bucket_for_key_with_hash(hash, &k) {
584- TableFull => fail!(~" Internal logic error"),
585- FoundEntry(idx) => idx,
586- FoundHole(idx) => {
587- let v = f(&k);
588- self.buckets[idx] = Some(Bucket{hash: hash, key: k,
589- value: v});
590- self.size += 1;
591- idx
592- },
593- };
594-
595- unsafe { // FIXME(#4903)---requires flow-sensitive borrow checker
596- ::cast::transmute_region(self.value_for_bucket(idx))
597- }
598- }
599-
600- /// Return the value corresponding to the key in the map, or create,
601- /// insert, and return a new value if it doesn't exist.
602- #[cfg(stage1)]
603- #[cfg(stage2)]
604- #[cfg(stage3)]
605461 fn find_or_insert_with<'a>(&'a mut self, k: K, f: &fn(&K) -> V) -> &'a V {
606462 if self.size >= self.resize_at {
607463 // n.b.: We could also do this after searching, so
@@ -647,17 +503,6 @@ pub impl<K: Hash + Eq, V> HashMap<K, V> {
647503 }
648504 }
649505
650- #[cfg(stage0)]
651- fn get(&self, k: &K) -> &'self V {
652- match self.find(k) {
653- Some(v) => v,
654- None => fail!(fmt!(" No entry found for key: %?", k)),
655- }
656- }
657-
658- #[cfg(stage1)]
659- #[cfg(stage2)]
660- #[cfg(stage3)]
661506 fn get<'a>(&'a self, k: &K) -> &'a V {
662507 match self.find(k) {
663508 Some(v) => v,
@@ -676,19 +521,6 @@ pub impl<K: Hash + Eq, V> HashMap<K, V> {
676521
677522 /// Return the value corresponding to the key in the map, using
678523 /// equivalence
679- #[ cfg( stage0) ]
680- fn find_equiv < Q : Hash + Equiv < K > > ( & self , k : & Q ) -> Option < & ' self V > {
681- match self . bucket_for_key_equiv ( k) {
682- FoundEntry ( idx) => Some ( self . value_for_bucket ( idx) ) ,
683- TableFull | FoundHole ( _) => None ,
684- }
685- }
686-
687- /// Return the value corresponding to the key in the map, using
688- /// equivalence
689- #[ cfg( stage1) ]
690- #[ cfg( stage2) ]
691- #[ cfg( stage3) ]
692524 fn find_equiv < ' a , Q : Hash + Equiv < K > > ( & ' a self , k : & Q ) -> Option < & ' a V > {
693525 match self . bucket_for_key_equiv ( k) {
694526 FoundEntry ( idx) => Some ( self . value_for_bucket ( idx) ) ,
0 commit comments