Make BTreeMap::new_in const

Closes rust-lang/wg-allocators#118
This commit is contained in:
Sven Bartscher 2023-10-09 11:08:48 +02:00
parent 093b9d5b29
commit bbc230478c

View File

@ -669,7 +669,7 @@ pub fn clear(&mut self) {
/// map.insert(1, "a");
/// ```
#[unstable(feature = "btreemap_alloc", issue = "32838")]
pub fn new_in(alloc: A) -> BTreeMap<K, V, A> {
pub const fn new_in(alloc: A) -> BTreeMap<K, V, A> {
BTreeMap { root: None, length: 0, alloc: ManuallyDrop::new(alloc), _marker: PhantomData }
}
}