@@ -1399,7 +1399,7 @@ impl<'a> From<&'a Path> for Box<Path> {
1399
1399
impl From < Box < Path > > for PathBuf {
1400
1400
/// Converts a `Box<Path>` into a `PathBuf`
1401
1401
///
1402
- /// This conversion does not allocate memory
1402
+ /// This conversion does not allocate or copy memory.
1403
1403
fn from ( boxed : Box < Path > ) -> PathBuf {
1404
1404
boxed. into_path_buf ( )
1405
1405
}
@@ -1409,7 +1409,8 @@ impl From<Box<Path>> for PathBuf {
1409
1409
impl From < PathBuf > for Box < Path > {
1410
1410
/// Converts a `PathBuf` into a `Box<Path>`
1411
1411
///
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.
1413
1414
fn from ( p : PathBuf ) -> Box < Path > {
1414
1415
p. into_boxed_path ( )
1415
1416
}
@@ -1434,7 +1435,7 @@ impl<'a, T: ?Sized + AsRef<OsStr>> From<&'a T> for PathBuf {
1434
1435
impl From < OsString > for PathBuf {
1435
1436
/// Converts a `OsString` into a `PathBuf`
1436
1437
///
1437
- /// This conversion does not allocate memory
1438
+ /// This conversion does not allocate or copy memory.
1438
1439
fn from ( s : OsString ) -> PathBuf {
1439
1440
PathBuf { inner : s }
1440
1441
}
@@ -1444,7 +1445,7 @@ impl From<OsString> for PathBuf {
1444
1445
impl From < PathBuf > for OsString {
1445
1446
/// Converts a `PathBuf` into a `OsString`
1446
1447
///
1447
- /// This conversion does not allocate memory
1448
+ /// This conversion does not allocate or copy memory.
1448
1449
fn from ( path_buf : PathBuf ) -> OsString {
1449
1450
path_buf. inner
1450
1451
}
@@ -1454,7 +1455,7 @@ impl From<PathBuf> for OsString {
1454
1455
impl From < String > for PathBuf {
1455
1456
/// Converts a `String` into a `PathBuf`
1456
1457
///
1457
- /// This conversion does not allocate memory
1458
+ /// This conversion does not allocate or copy memory.
1458
1459
fn from ( s : String ) -> PathBuf {
1459
1460
PathBuf :: from ( OsString :: from ( s) )
1460
1461
}
@@ -1551,11 +1552,7 @@ impl<'a> From<Cow<'a, Path>> for PathBuf {
1551
1552
1552
1553
#[ stable( feature = "shared_from_slice2" , since = "1.24.0" ) ]
1553
1554
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.
1559
1556
#[ inline]
1560
1557
fn from ( s : PathBuf ) -> Arc < Path > {
1561
1558
let arc: Arc < OsStr > = Arc :: from ( s. into_os_string ( ) ) ;
@@ -1565,12 +1562,7 @@ impl From<PathBuf> for Arc<Path> {
1565
1562
1566
1563
#[ stable( feature = "shared_from_slice2" , since = "1.24.0" ) ]
1567
1564
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.
1574
1566
#[ inline]
1575
1567
fn from ( s : & Path ) -> Arc < Path > {
1576
1568
let arc: Arc < OsStr > = Arc :: from ( s. as_os_str ( ) ) ;
@@ -1580,11 +1572,7 @@ impl<'a> From<&'a Path> for Arc<Path> {
1580
1572
1581
1573
#[ stable( feature = "shared_from_slice2" , since = "1.24.0" ) ]
1582
1574
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.
1588
1576
#[ inline]
1589
1577
fn from ( s : PathBuf ) -> Rc < Path > {
1590
1578
let rc: Rc < OsStr > = Rc :: from ( s. into_os_string ( ) ) ;
@@ -1594,6 +1582,7 @@ impl From<PathBuf> for Rc<Path> {
1594
1582
1595
1583
#[ stable( feature = "shared_from_slice2" , since = "1.24.0" ) ]
1596
1584
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.
1597
1586
#[ inline]
1598
1587
fn from ( s : & Path ) -> Rc < Path > {
1599
1588
let rc: Rc < OsStr > = Rc :: from ( s. as_os_str ( ) ) ;
0 commit comments