Skip to content

Commit e8dafba

Browse files
author
Bastian Gruber
committed
Adjust doc comments
1 parent 5c747eb commit e8dafba

File tree

1 file changed

+10
-21
lines changed

1 file changed

+10
-21
lines changed

src/libstd/path.rs

Lines changed: 10 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1399,7 +1399,7 @@ impl<'a> From<&'a Path> for Box<Path> {
13991399
impl From<Box<Path>> for PathBuf {
14001400
/// Converts a `Box<Path>` into a `PathBuf`
14011401
///
1402-
/// This conversion does not allocate memory
1402+
/// This conversion does not allocate or copy memory.
14031403
fn from(boxed: Box<Path>) -> PathBuf {
14041404
boxed.into_path_buf()
14051405
}
@@ -1409,7 +1409,8 @@ impl From<Box<Path>> for PathBuf {
14091409
impl From<PathBuf> for Box<Path> {
14101410
/// Converts a `PathBuf` into a `Box<Path>`
14111411
///
1412-
/// This conversion does not allocate memory
1412+
/// This conversion currently should not allocate memory,
1413+
// but this behavior is not guaranteed on all platforms or in all future versions.
14131414
fn from(p: PathBuf) -> Box<Path> {
14141415
p.into_boxed_path()
14151416
}
@@ -1434,7 +1435,7 @@ impl<'a, T: ?Sized + AsRef<OsStr>> From<&'a T> for PathBuf {
14341435
impl From<OsString> for PathBuf {
14351436
/// Converts a `OsString` into a `PathBuf`
14361437
///
1437-
/// This conversion does not allocate memory
1438+
/// This conversion does not allocate or copy memory.
14381439
fn from(s: OsString) -> PathBuf {
14391440
PathBuf { inner: s }
14401441
}
@@ -1444,7 +1445,7 @@ impl From<OsString> for PathBuf {
14441445
impl From<PathBuf> for OsString {
14451446
/// Converts a `PathBuf` into a `OsString`
14461447
///
1447-
/// This conversion does not allocate memory
1448+
/// This conversion does not allocate or copy memory.
14481449
fn from(path_buf : PathBuf) -> OsString {
14491450
path_buf.inner
14501451
}
@@ -1454,7 +1455,7 @@ impl From<PathBuf> for OsString {
14541455
impl From<String> for PathBuf {
14551456
/// Converts a `String` into a `PathBuf`
14561457
///
1457-
/// This conversion does not allocate memory
1458+
/// This conversion does not allocate or copy memory.
14581459
fn from(s: String) -> PathBuf {
14591460
PathBuf::from(OsString::from(s))
14601461
}
@@ -1551,11 +1552,7 @@ impl<'a> From<Cow<'a, Path>> for PathBuf {
15511552

15521553
#[stable(feature = "shared_from_slice2", since = "1.24.0")]
15531554
impl From<PathBuf> for Arc<Path> {
1554-
/// Converts a `PathBuf` into a `Arc<Path>`
1555-
///
1556-
/// This conversion happens in place
1557-
///
1558-
/// This conversion does not allocate memory
1555+
/// Converts a Path into a Rc by copying the Path data into a new Rc buffer.
15591556
#[inline]
15601557
fn from(s: PathBuf) -> Arc<Path> {
15611558
let arc: Arc<OsStr> = Arc::from(s.into_os_string());
@@ -1565,12 +1562,7 @@ impl From<PathBuf> for Arc<Path> {
15651562

15661563
#[stable(feature = "shared_from_slice2", since = "1.24.0")]
15671564
impl<'a> From<&'a Path> for Arc<Path> {
1568-
/// Converts a `PathBuf` into a `Arc<Path>`
1569-
///
1570-
/// This conversion happens in place
1571-
///
1572-
/// This conversion does not allocate memory
1573-
///
1565+
/// Converts a Path into a Rc by copying the Path data into a new Rc buffer.
15741566
#[inline]
15751567
fn from(s: &Path) -> Arc<Path> {
15761568
let arc: Arc<OsStr> = Arc::from(s.as_os_str());
@@ -1580,11 +1572,7 @@ impl<'a> From<&'a Path> for Arc<Path> {
15801572

15811573
#[stable(feature = "shared_from_slice2", since = "1.24.0")]
15821574
impl From<PathBuf> for Rc<Path> {
1583-
/// Converts a `PathBuf` into a `Rc<Path>`
1584-
///
1585-
/// This conversion happens in place
1586-
///
1587-
/// This conversion does not allocate memory
1575+
/// Converts a Path into a Rc by copying the Path data into a new Rc buffer.
15881576
#[inline]
15891577
fn from(s: PathBuf) -> Rc<Path> {
15901578
let rc: Rc<OsStr> = Rc::from(s.into_os_string());
@@ -1594,6 +1582,7 @@ impl From<PathBuf> for Rc<Path> {
15941582

15951583
#[stable(feature = "shared_from_slice2", since = "1.24.0")]
15961584
impl<'a> From<&'a Path> for Rc<Path> {
1585+
/// Converts a Path into a Rc by copying the Path data into a new Rc buffer.
15971586
#[inline]
15981587
fn from(s: &Path) -> Rc<Path> {
15991588
let rc: Rc<OsStr> = Rc::from(s.as_os_str());

0 commit comments

Comments
 (0)