diff options
| author | Zachary S <zasample18+github@gmail.com> | 2024-05-11 07:11:36 -0500 |
|---|---|---|
| committer | Zachary S <zasample18+github@gmail.com> | 2024-05-12 20:27:29 -0500 |
| commit | 0b3ebb546fac5de6be624d335abb3c5f7ad82c74 (patch) | |
| tree | a6c27e7b7c35ca89430b10b4599961c50f05f6ef /library/alloc/src | |
| parent | 5c6326ad799511e59b1de60b25603309d5322090 (diff) | |
Add note about possible allocation-sharing to Arc/Rc<str/[T]/CStr>::default.
Diffstat (limited to 'library/alloc/src')
| -rw-r--r-- | library/alloc/src/ffi/c_str.rs | 4 | ||||
| -rw-r--r-- | library/alloc/src/rc.rs | 4 | ||||
| -rw-r--r-- | library/alloc/src/sync.rs | 4 |
3 files changed, 12 insertions, 0 deletions
diff --git a/library/alloc/src/ffi/c_str.rs b/library/alloc/src/ffi/c_str.rs index 19dd90eb81f..3b56a5717e2 100644 --- a/library/alloc/src/ffi/c_str.rs +++ b/library/alloc/src/ffi/c_str.rs @@ -914,6 +914,8 @@ impl From<&CStr> for Rc<CStr> { #[stable(feature = "more_rc_default_impls", since = "CURRENT_RUSTC_VERSION")] impl Default for Arc<CStr> { /// Creates an empty CStr inside an Arc + /// + /// This may or may not share an allocation with other Arcs. #[inline] fn default() -> Self { let c_str: &CStr = Default::default(); @@ -925,6 +927,8 @@ impl Default for Arc<CStr> { #[stable(feature = "more_rc_default_impls", since = "CURRENT_RUSTC_VERSION")] impl Default for Rc<CStr> { /// Creates an empty CStr inside an Rc + /// + /// This may or may not share an allocation with other Rcs on the same thread. #[inline] fn default() -> Self { let c_str: &CStr = Default::default(); diff --git a/library/alloc/src/rc.rs b/library/alloc/src/rc.rs index 206489876e3..dddd0603a15 100644 --- a/library/alloc/src/rc.rs +++ b/library/alloc/src/rc.rs @@ -2228,6 +2228,8 @@ impl<T: Default> Default for Rc<T> { #[stable(feature = "more_rc_default_impls", since = "CURRENT_RUSTC_VERSION")] impl Default for Rc<str> { /// Creates an empty str inside an Rc + /// + /// This may or may not share an allocation with other Rcs on the same thread. #[inline] fn default() -> Self { Rc::from("") @@ -2238,6 +2240,8 @@ impl Default for Rc<str> { #[stable(feature = "more_rc_default_impls", since = "CURRENT_RUSTC_VERSION")] impl<T> Default for Rc<[T]> { /// Creates an empty `[T]` inside an Rc + /// + /// This may or may not share an allocation with other Rcs on the same thread. #[inline] fn default() -> Self { let arr: [T; 0] = []; diff --git a/library/alloc/src/sync.rs b/library/alloc/src/sync.rs index 5f6ce80e194..f06994f7c40 100644 --- a/library/alloc/src/sync.rs +++ b/library/alloc/src/sync.rs @@ -3304,6 +3304,8 @@ impl<T: Default> Default for Arc<T> { #[stable(feature = "more_rc_default_impls", since = "CURRENT_RUSTC_VERSION")] impl Default for Arc<str> { /// Creates an empty str inside an Arc + /// + /// This may or may not share an allocation with other Arcs. #[inline] fn default() -> Self { Arc::from("") @@ -3314,6 +3316,8 @@ impl Default for Arc<str> { #[stable(feature = "more_rc_default_impls", since = "CURRENT_RUSTC_VERSION")] impl<T> Default for Arc<[T]> { /// Creates an empty `[T]` inside an Arc + /// + /// This may or may not share an allocation with other Arcs. #[inline] fn default() -> Self { let arr: [T; 0] = []; |
