Skip to content

Commit

Permalink
auto merge of #5696 : thestinger/rust/hashmap, r=sanxiyn
Browse files Browse the repository at this point in the history
This naming is free now that `oldmap` has finally been removed, so this is a search-and-replace to take advantage of that. It might as well be called `HashMap` instead of being named after the specific implementation, since there's only one.

SipHash distributes keys so well that I don't think there will ever be much need to use anything but a simple hash table with open addressing. If there *is* a better way to do it, it will probably be better in all cases and can just be the default implementation. 

A cuckoo-hashing implementation combining a weaker hash with SipHash could be useful, but that won't be as general purpose - you would need to write a separate fast hash function specialized for the type to really take advantage of it (like taking a page from libstdc++/libc++ and just using the integer value as the "hash"). I think a more specific naming for a truly alternative implementation like that would be fine, with the nice naming reserved for the general purpose container.
  • Loading branch information
bors committed Apr 3, 2013
2 parents 6153aae + cc148b5 commit 5b933ae
Show file tree
Hide file tree
Showing 76 changed files with 1,305 additions and 1,309 deletions.
4 changes: 2 additions & 2 deletions doc/rust.md
Original file line number Diff line number Diff line change
Expand Up @@ -441,10 +441,10 @@ expression context, the final namespace qualifier is omitted.
Two examples of paths with type arguments:

~~~~
# use core::hashmap::linear::LinearMap;
# use core::hashmap::HashMap;
# fn f() {
# fn id<T:Copy>(t: T) -> T { t }
type t = LinearMap<int,~str>; // Type arguments used in a type expression
type t = HashMap<int,~str>; // Type arguments used in a type expression
let x = id::<int>(10); // Type arguments used in a call expression
# }
~~~~
Expand Down
4 changes: 2 additions & 2 deletions doc/tutorial.md
Original file line number Diff line number Diff line change
Expand Up @@ -1888,8 +1888,8 @@ illegal to copy and pass by value.
Generic `type`, `struct`, and `enum` declarations follow the same pattern:

~~~~
# use core::hashmap::linear::LinearMap;
type Set<T> = LinearMap<T, ()>;
# use core::hashmap::HashMap;
type Set<T> = HashMap<T, ()>;
struct Stack<T> {
elements: ~[T]
Expand Down
4 changes: 2 additions & 2 deletions src/libcore/gc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ use io;
use libc::{size_t, uintptr_t};
use option::{None, Option, Some};
use ptr;
use hashmap::linear::LinearSet;
use hashmap::HashSet;
use stackwalk;
use sys;

Expand Down Expand Up @@ -344,7 +344,7 @@ pub fn cleanup_stack_for_failure() {
ptr::null()
};

let mut roots = LinearSet::new();
let mut roots = HashSet::new();
for walk_gc_roots(need_cleanup, sentinel) |root, tydesc| {
// Track roots to avoid double frees.
if roots.contains(&*root) {
Expand Down
Loading

0 comments on commit 5b933ae

Please sign in to comment.