Skip to content

Commit 4d56731

Browse files
committed
Make HashMap unstable in liballoc but stable in libstd
1 parent 4331ada commit 4d56731

File tree

3 files changed

+18
-5
lines changed

3 files changed

+18
-5
lines changed

src/liballoc/collections/mod.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,14 @@ pub mod btree_set {
3232
pub use super::btree::set::*;
3333
}
3434

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

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

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

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

src/libstd/collections.rs

+13-1
Original file line numberDiff line numberDiff line change
@@ -433,8 +433,20 @@ pub use alloc_crate::collections::{binary_heap, btree_map, btree_set};
433433
pub use alloc_crate::collections::{linked_list, vec_deque};
434434
#[stable(feature = "rust1", since = "1.0.0")]
435435
pub use alloc_crate::collections::{HashMap, HashSet};
436+
437+
// We can't just re-export the modules directly since they are unstable in liballoc
438+
#[stable(feature = "rust1", since = "1.0.0")]
439+
pub mod hash_map {
440+
//! A hash map implemented with linear probing and Robin Hood bucket stealing.
441+
#[stable(feature = "rust1", since = "1.0.0")]
442+
pub use alloc_crate::collections::hash_map::*;
443+
}
436444
#[stable(feature = "rust1", since = "1.0.0")]
437-
pub use alloc_crate::collections::{hash_map, hash_set};
445+
pub mod hash_set {
446+
//! A hash set implemented as a `HashMap` where the value is `()`.
447+
#[stable(feature = "rust1", since = "1.0.0")]
448+
pub use alloc_crate::collections::hash_set::*;
449+
}
438450

439451
#[unstable(feature = "try_reserve", reason = "new API", issue="48043")]
440452
pub use alloc_crate::collections::CollectionAllocErr;

src/libstd/lib.rs

+1
Original file line numberDiff line numberDiff line change
@@ -322,6 +322,7 @@
322322
#![feature(float_internals)]
323323
#![feature(panic_info_message)]
324324
#![feature(panic_implementation)]
325+
#![feature(alloc_hashmap)]
325326

326327
#![default_lib_allocator]
327328

0 commit comments

Comments
 (0)