about summary refs log tree commit diff
path: root/library/core/src/ptr/alignment.rs
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2025-07-08 14:04:40 +0000
committerbors <bors@rust-lang.org>2025-07-08 14:04:40 +0000
commitf838cbc06de60819faff3413f374706b74824ca2 (patch)
treea4cff09f57a030086065792de4df4ba27c887af8 /library/core/src/ptr/alignment.rs
parent040e2f8b9ff2d76fbe2146d6003e297ed4532088 (diff)
parent8f8099fb42f0b067cd9b6a82e704ce3cc0e63301 (diff)
downloadrust-f838cbc06de60819faff3413f374706b74824ca2.tar.gz
rust-f838cbc06de60819faff3413f374706b74824ca2.zip
Auto merge of #134628 - estebank:const-default, r=oli-obk
Make `Default` const and add some `const Default` impls

Full list of `impl const Default` types:

- ()
- bool
- char
- 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/core/src/ptr/alignment.rs')
-rw-r--r--library/core/src/ptr/alignment.rs3
1 files changed, 2 insertions, 1 deletions
diff --git a/library/core/src/ptr/alignment.rs b/library/core/src/ptr/alignment.rs
index 3e66e271f03..304cde05af9 100644
--- a/library/core/src/ptr/alignment.rs
+++ b/library/core/src/ptr/alignment.rs
@@ -230,7 +230,8 @@ impl hash::Hash for Alignment {
 
 /// Returns [`Alignment::MIN`], which is valid for any type.
 #[unstable(feature = "ptr_alignment_type", issue = "102070")]
-impl Default for Alignment {
+#[rustc_const_unstable(feature = "const_default", issue = "67792")]
+impl const Default for Alignment {
     fn default() -> Alignment {
         Alignment::MIN
     }