Skip to content

Commit

Permalink
Make HashMap unstable in liballoc but stable in libstd
Browse files Browse the repository at this point in the history
  • Loading branch information
Amanieu committed Jul 3, 2018
1 parent 4331ada commit 4d56731
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 5 deletions.
8 changes: 4 additions & 4 deletions src/liballoc/collections/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,14 @@ pub mod btree_set {
pub use super::btree::set::*;
}

#[stable(feature = "rust1", since = "1.0.0")]
#[unstable(feature = "alloc_hashmap", reason = "HashMap in liballoc is unstable", issue="0")]
pub mod hash_map {
//! A hash map implemented with linear probing and Robin Hood bucket stealing.
#[stable(feature = "rust1", since = "1.0.0")]
pub use super::hash::map::*;
}

#[stable(feature = "rust1", since = "1.0.0")]
#[unstable(feature = "alloc_hashmap", reason = "HashMap in liballoc is unstable", issue="0")]
pub mod hash_set {
//! A hash set implemented as a `HashMap` where the value is `()`.
#[stable(feature = "rust1", since = "1.0.0")]
Expand All @@ -58,11 +58,11 @@ pub use self::btree_map::BTreeMap;
#[doc(no_inline)]
pub use self::btree_set::BTreeSet;

#[stable(feature = "rust1", since = "1.0.0")]
#[unstable(feature = "alloc_hashmap", reason = "HashMap in liballoc is unstable", issue="0")]
#[doc(no_inline)]
pub use self::hash_map::HashMap;

#[stable(feature = "rust1", since = "1.0.0")]
#[unstable(feature = "alloc_hashmap", reason = "HashMap in liballoc is unstable", issue="0")]
#[doc(no_inline)]
pub use self::hash_set::HashSet;

Expand Down
14 changes: 13 additions & 1 deletion src/libstd/collections.rs
Original file line number Diff line number Diff line change
Expand Up @@ -433,8 +433,20 @@ pub use alloc_crate::collections::{binary_heap, btree_map, btree_set};
pub use alloc_crate::collections::{linked_list, vec_deque};
#[stable(feature = "rust1", since = "1.0.0")]
pub use alloc_crate::collections::{HashMap, HashSet};

// We can't just re-export the modules directly since they are unstable in liballoc
#[stable(feature = "rust1", since = "1.0.0")]
pub mod hash_map {
//! A hash map implemented with linear probing and Robin Hood bucket stealing.
#[stable(feature = "rust1", since = "1.0.0")]
pub use alloc_crate::collections::hash_map::*;
}
#[stable(feature = "rust1", since = "1.0.0")]
pub use alloc_crate::collections::{hash_map, hash_set};
pub mod hash_set {
//! A hash set implemented as a `HashMap` where the value is `()`.
#[stable(feature = "rust1", since = "1.0.0")]
pub use alloc_crate::collections::hash_set::*;
}

#[unstable(feature = "try_reserve", reason = "new API", issue="48043")]
pub use alloc_crate::collections::CollectionAllocErr;
Expand Down
1 change: 1 addition & 0 deletions src/libstd/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,7 @@
#![feature(float_internals)]
#![feature(panic_info_message)]
#![feature(panic_implementation)]
#![feature(alloc_hashmap)]

#![default_lib_allocator]

Expand Down

0 comments on commit 4d56731

Please sign in to comment.