diff options
| author | Billy Sheppard <billy.sheppard@rmhedge.com> | 2024-05-03 00:10:40 +0000 |
|---|---|---|
| committer | Zachary S <zasample18+github@gmail.com> | 2024-05-12 20:27:28 -0500 |
| commit | 5c6326ad799511e59b1de60b25603309d5322090 (patch) | |
| tree | a0ed4bd62e9313e6c4d9cfbff24c24773cc9afd3 /library/alloc/src/rc.rs | |
| parent | ecbe3fd550fccd2cba17ea7e86539bf3e0bfc618 (diff) | |
| download | rust-5c6326ad799511e59b1de60b25603309d5322090.tar.gz rust-5c6326ad799511e59b1de60b25603309d5322090.zip | |
added Default impls
reorganised attrs removed OsStr impls added backticks
Diffstat (limited to 'library/alloc/src/rc.rs')
| -rw-r--r-- | library/alloc/src/rc.rs | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/library/alloc/src/rc.rs b/library/alloc/src/rc.rs index 45b20535675..206489876e3 100644 --- a/library/alloc/src/rc.rs +++ b/library/alloc/src/rc.rs @@ -2224,6 +2224,27 @@ impl<T: Default> Default for Rc<T> { } } +#[cfg(not(no_global_oom_handling))] +#[stable(feature = "more_rc_default_impls", since = "CURRENT_RUSTC_VERSION")] +impl Default for Rc<str> { + /// Creates an empty str inside an Rc + #[inline] + fn default() -> Self { + Rc::from("") + } +} + +#[cfg(not(no_global_oom_handling))] +#[stable(feature = "more_rc_default_impls", since = "CURRENT_RUSTC_VERSION")] +impl<T> Default for Rc<[T]> { + /// Creates an empty `[T]` inside an Rc + #[inline] + fn default() -> Self { + let arr: [T; 0] = []; + Rc::from(arr) + } +} + #[stable(feature = "rust1", since = "1.0.0")] trait RcEqIdent<T: ?Sized + PartialEq, A: Allocator> { fn eq(&self, other: &Rc<T, A>) -> bool; |
