Add note about possible allocation-sharing to Arc/Rc<str/[T]/CStr>::default.
diff --git a/library/alloc/src/ffi/c_str.rs b/library/alloc/src/ffi/c_str.rs
index 19dd90e..3b56a57 100644
--- a/library/alloc/src/ffi/c_str.rs
+++ b/library/alloc/src/ffi/c_str.rs
@@ -914,6 +914,8 @@ fn from(s: &CStr) -> 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 @@ fn default() -> Self {
#[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 2064898..dddd060 100644
--- a/library/alloc/src/rc.rs
+++ b/library/alloc/src/rc.rs
@@ -2228,6 +2228,8 @@ fn default() -> 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 @@ fn default() -> Self {
#[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 5f6ce80..f06994f 100644
--- a/library/alloc/src/sync.rs
+++ b/library/alloc/src/sync.rs
@@ -3304,6 +3304,8 @@ fn default() -> 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 @@ fn default() -> Self {
#[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] = [];