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.
2 parents 89fe961 + 264c6d4 commit 0b9ba3dCopy full SHA for 0b9ba3d
library/core/src/mem/mod.rs
@@ -808,7 +808,8 @@ pub const fn swap<T>(x: &mut T, y: &mut T) {
808
/// ```
809
#[inline]
810
#[stable(feature = "mem_take", since = "1.40.0")]
811
-pub fn take<T: Default>(dest: &mut T) -> T {
+#[rustc_const_unstable(feature = "const_default", issue = "143894")]
812
+pub const fn take<T: [const] Default>(dest: &mut T) -> T {
813
replace(dest, T::default())
814
}
815
0 commit comments