Skip to content

Commit 7bc47cf

Browse files
committed
Correct docs in Arc and Rc.
A number of trait implementations incorrectly claimed to be zero cost.
1 parent 237949b commit 7bc47cf

File tree

3 files changed

+13
-7
lines changed

3 files changed

+13
-7
lines changed

library/std/src/ffi/c_str.rs

+4-2
Original file line numberDiff line numberDiff line change
@@ -973,7 +973,8 @@ impl<'a> From<&'a CString> for Cow<'a, CStr> {
973973

974974
#[stable(feature = "shared_from_slice2", since = "1.24.0")]
975975
impl From<CString> for Arc<CStr> {
976-
/// Converts a [`CString`] into an <code>[Arc]<[CStr]></code> without copying or allocating.
976+
/// Converts a [`CString`] into an <code>[Arc]<[CStr]></code> by moving the [`CString`]
977+
/// data into a new [`Arc`] buffer.
977978
#[inline]
978979
fn from(s: CString) -> Arc<CStr> {
979980
let arc: Arc<[u8]> = Arc::from(s.into_inner());
@@ -992,7 +993,8 @@ impl From<&CStr> for Arc<CStr> {
992993

993994
#[stable(feature = "shared_from_slice2", since = "1.24.0")]
994995
impl From<CString> for Rc<CStr> {
995-
/// Converts a [`CString`] into an <code>[Rc]<[CStr]></code> without copying or allocating.
996+
/// Converts a [`CString`] into an <code>[Rc]<[CStr]></code> by moving the [`CString`]
997+
/// data into a new [`Arc`] buffer.
996998
#[inline]
997999
fn from(s: CString) -> Rc<CStr> {
9981000
let rc: Rc<[u8]> = Rc::from(s.into_inner());

library/std/src/ffi/os_str.rs

+4-2
Original file line numberDiff line numberDiff line change
@@ -989,7 +989,8 @@ impl Clone for Box<OsStr> {
989989

990990
#[stable(feature = "shared_from_slice2", since = "1.24.0")]
991991
impl From<OsString> for Arc<OsStr> {
992-
/// Converts an [`OsString`] into an <code>[Arc]<[OsStr]></code> without copying or allocating.
992+
/// Converts an [`OsString`] into an <code>[Arc]<[OsStr]></code> by moving the [`OsString`]
993+
/// data into a new [`Arc`] buffer.
993994
#[inline]
994995
fn from(s: OsString) -> Arc<OsStr> {
995996
let arc = s.inner.into_arc();
@@ -1008,7 +1009,8 @@ impl From<&OsStr> for Arc<OsStr> {
10081009

10091010
#[stable(feature = "shared_from_slice2", since = "1.24.0")]
10101011
impl From<OsString> for Rc<OsStr> {
1011-
/// Converts an [`OsString`] into an <code>[Rc]<[OsStr]></code> without copying or allocating.
1012+
/// Converts an [`OsString`] into an <code>[Rc]<[OsStr]></code> by moving the [`OsString`]
1013+
/// data into a new [`Rc`] buffer.
10121014
#[inline]
10131015
fn from(s: OsString) -> Rc<OsStr> {
10141016
let rc = s.inner.into_rc();

library/std/src/path.rs

+5-3
Original file line numberDiff line numberDiff line change
@@ -1766,7 +1766,8 @@ impl<'a> From<Cow<'a, Path>> for PathBuf {
17661766

17671767
#[stable(feature = "shared_from_slice2", since = "1.24.0")]
17681768
impl From<PathBuf> for Arc<Path> {
1769-
/// Converts a [`PathBuf`] into an [`Arc`] by moving the [`PathBuf`] data into a new [`Arc`] buffer.
1769+
/// Converts a [`PathBuf`] into an <code>[Arc]<[Path]></code> by moving the [`PathBuf`] data
1770+
/// into a new [`Arc`] buffer.
17701771
#[inline]
17711772
fn from(s: PathBuf) -> Arc<Path> {
17721773
let arc: Arc<OsStr> = Arc::from(s.into_os_string());
@@ -1786,7 +1787,8 @@ impl From<&Path> for Arc<Path> {
17861787

17871788
#[stable(feature = "shared_from_slice2", since = "1.24.0")]
17881789
impl From<PathBuf> for Rc<Path> {
1789-
/// Converts a [`PathBuf`] into an [`Rc`] by moving the [`PathBuf`] data into a new `Rc` buffer.
1790+
/// Converts a [`PathBuf`] into an <code>[Rc]<[Path]></code> by moving the [`PathBuf`] data into
1791+
/// a new [`Rc`] buffer.
17901792
#[inline]
17911793
fn from(s: PathBuf) -> Rc<Path> {
17921794
let rc: Rc<OsStr> = Rc::from(s.into_os_string());
@@ -1796,7 +1798,7 @@ impl From<PathBuf> for Rc<Path> {
17961798

17971799
#[stable(feature = "shared_from_slice2", since = "1.24.0")]
17981800
impl From<&Path> for Rc<Path> {
1799-
/// Converts a [`Path`] into an [`Rc`] by copying the [`Path`] data into a new `Rc` buffer.
1801+
/// Converts a [`Path`] into an [`Rc`] by copying the [`Path`] data into a new [`Rc`] buffer.
18001802
#[inline]
18011803
fn from(s: &Path) -> Rc<Path> {
18021804
let rc: Rc<OsStr> = Rc::from(s.as_os_str());

0 commit comments

Comments
 (0)