mirror of
https://github.com/rust-lang/rust.git
synced 2026-05-28 20:16:58 +03:00
Rollup merge of #148757 - nxsaken:const_mem_take, r=scottmcm
Constify `mem::take` Feature: `const_default` (rust-lang/rust#143894)
This commit is contained in:
@@ -808,7 +808,8 @@ pub const fn swap<T>(x: &mut T, y: &mut T) {
|
||||
/// ```
|
||||
#[inline]
|
||||
#[stable(feature = "mem_take", since = "1.40.0")]
|
||||
pub fn take<T: Default>(dest: &mut T) -> T {
|
||||
#[rustc_const_unstable(feature = "const_default", issue = "143894")]
|
||||
pub const fn take<T: [const] Default>(dest: &mut T) -> T {
|
||||
replace(dest, T::default())
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user