diff options
| author | Esteban Küber <esteban@kuber.com.ar> | 2024-12-21 20:25:43 +0000 |
|---|---|---|
| committer | Esteban Küber <esteban@kuber.com.ar> | 2025-07-07 22:09:37 +0000 |
| commit | c3301503b97cd6b768a944661b81a92994e9db00 (patch) | |
| tree | 6beacc787162110dba8aeab9c73034d261d6b128 /library/core/src/str/mod.rs | |
| parent | 2f8eeb2bba86b8f457ec602c578473c711f85628 (diff) | |
| download | rust-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/core/src/str/mod.rs')
| -rw-r--r-- | library/core/src/str/mod.rs | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/library/core/src/str/mod.rs b/library/core/src/str/mod.rs index fe64132ff22..32a22988175 100644 --- a/library/core/src/str/mod.rs +++ b/library/core/src/str/mod.rs @@ -3072,7 +3072,8 @@ impl AsRef<[u8]> for str { } #[stable(feature = "rust1", since = "1.0.0")] -impl Default for &str { +#[rustc_const_unstable(feature = "const_default", issue = "67792")] +impl const Default for &str { /// Creates an empty str #[inline] fn default() -> Self { @@ -3081,7 +3082,8 @@ impl Default for &str { } #[stable(feature = "default_mut_str", since = "1.28.0")] -impl Default for &mut str { +#[rustc_const_unstable(feature = "const_default", issue = "67792")] +impl const Default for &mut str { /// Creates an empty mutable str #[inline] fn default() -> Self { |
