Skip to content

Commit 264c6d4

Browse files
committed
Constify mem::take
1 parent ab67c37 commit 264c6d4

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

library/core/src/mem/mod.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -807,7 +807,8 @@ pub const fn swap<T>(x: &mut T, y: &mut T) {
807807
/// ```
808808
#[inline]
809809
#[stable(feature = "mem_take", since = "1.40.0")]
810-
pub fn take<T: Default>(dest: &mut T) -> T {
810+
#[rustc_const_unstable(feature = "const_default", issue = "143894")]
811+
pub const fn take<T: [const] Default>(dest: &mut T) -> T {
811812
replace(dest, T::default())
812813
}
813814

0 commit comments

Comments
 (0)