Skip to content

Commit b0cc078

Browse files
Rollup merge of rust-lang#116559 - Kritzefitz:btree-new-in-const, r=Amanieu
Mark `new_in` as `const` for BTree collections Discussed in and closes rust-lang/wg-allocators#118
2 parents e33f6a6 + 349d5f5 commit b0cc078

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

alloc/src/collections/btree/map.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -669,7 +669,7 @@ impl<K, V, A: Allocator + Clone> BTreeMap<K, V, A> {
669669
/// map.insert(1, "a");
670670
/// ```
671671
#[unstable(feature = "btreemap_alloc", issue = "32838")]
672-
pub fn new_in(alloc: A) -> BTreeMap<K, V, A> {
672+
pub const fn new_in(alloc: A) -> BTreeMap<K, V, A> {
673673
BTreeMap { root: None, length: 0, alloc: ManuallyDrop::new(alloc), _marker: PhantomData }
674674
}
675675
}

alloc/src/collections/btree/set.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -358,7 +358,7 @@ impl<T, A: Allocator + Clone> BTreeSet<T, A> {
358358
/// let mut set: BTreeSet<i32> = BTreeSet::new_in(Global);
359359
/// ```
360360
#[unstable(feature = "btreemap_alloc", issue = "32838")]
361-
pub fn new_in(alloc: A) -> BTreeSet<T, A> {
361+
pub const fn new_in(alloc: A) -> BTreeSet<T, A> {
362362
BTreeSet { map: BTreeMap::new_in(alloc) }
363363
}
364364

0 commit comments

Comments
 (0)