about summary refs log tree commit diff
path: root/library/alloc/src/vec/mod.rs
diff options
context:
space:
mode:
authorEsteban Küber <esteban@kuber.com.ar>2024-12-21 20:25:43 +0000
committerEsteban Küber <esteban@kuber.com.ar>2025-07-07 22:09:37 +0000
commitc3301503b97cd6b768a944661b81a92994e9db00 (patch)
tree6beacc787162110dba8aeab9c73034d261d6b128 /library/alloc/src/vec/mod.rs
parent2f8eeb2bba86b8f457ec602c578473c711f85628 (diff)
downloadrust-c3301503b97cd6b768a944661b81a92994e9db00.tar.gz
rust-c3301503b97cd6b768a944661b81a92994e9db00.zip
Make `Default` const and add some `const Default` impls
Full list of `impl const Default` types:

- ()
- bool
- char
- Cell
- std::ascii::Char
- usize
- u8
- u16
- u32
- u64
- u128
- i8
- i16
- i32
- i64
- i128
- f16
- f32
- f64
- f128
- std::marker::PhantomData<T>
- Option<T>
- std::iter::Empty<T>
- std::ptr::Alignment
- &[T]
- &mut [T]
- &str
- &mut str
- String
- Vec<T>
Diffstat (limited to 'library/alloc/src/vec/mod.rs')
-rw-r--r--library/alloc/src/vec/mod.rs3
1 files changed, 2 insertions, 1 deletions
diff --git a/library/alloc/src/vec/mod.rs b/library/alloc/src/vec/mod.rs
index c8341750f4d..9dac58bac4f 100644
--- a/library/alloc/src/vec/mod.rs
+++ b/library/alloc/src/vec/mod.rs
@@ -3895,7 +3895,8 @@ unsafe impl<#[may_dangle] T, A: Allocator> Drop for Vec<T, A> {
 }
 
 #[stable(feature = "rust1", since = "1.0.0")]
-impl<T> Default for Vec<T> {
+#[rustc_const_unstable(feature = "const_default", issue = "67792")]
+impl<T> const Default for Vec<T> {
     /// Creates an empty `Vec<T>`.
     ///
     /// The vector will not allocate until elements are pushed onto it.