We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
mem::take
1 parent ab67c37 commit 264c6d4Copy full SHA for 264c6d4
library/core/src/mem/mod.rs
@@ -807,7 +807,8 @@ pub const fn swap<T>(x: &mut T, y: &mut T) {
807
/// ```
808
#[inline]
809
#[stable(feature = "mem_take", since = "1.40.0")]
810
-pub fn take<T: Default>(dest: &mut T) -> T {
+#[rustc_const_unstable(feature = "const_default", issue = "143894")]
811
+pub const fn take<T: [const] Default>(dest: &mut T) -> T {
812
replace(dest, T::default())
813
}
814
0 commit comments