rollup merge of #22210: aturon/stab-final-borrow
Conflicts: src/libcollections/btree/map.rs src/libcollections/str.rs src/libcollections/vec.rs src/libcore/borrow.rs src/libcore/hash/mod.rs src/libstd/collections/hash/map.rs src/libstd/collections/hash/set.rs
This commit is contained in:
commit
2cdbd288ac
29 changed files with 766 additions and 514 deletions
|
@ -108,12 +108,11 @@
|
|||
use core::prelude::*;
|
||||
|
||||
use ascii::*;
|
||||
use borrow::BorrowFrom;
|
||||
use borrow::{Borrow, ToOwned, Cow};
|
||||
use cmp;
|
||||
use iter::{self, IntoIterator};
|
||||
use mem;
|
||||
use ops::{self, Deref};
|
||||
use string::CowString;
|
||||
use vec::Vec;
|
||||
use fmt;
|
||||
|
||||
|
@ -982,12 +981,17 @@ impl ops::Deref for PathBuf {
|
|||
}
|
||||
}
|
||||
|
||||
impl BorrowFrom<PathBuf> for Path {
|
||||
fn borrow_from(owned: &PathBuf) -> &Path {
|
||||
owned.deref()
|
||||
impl Borrow<Path> for PathBuf {
|
||||
fn borrow(&self) -> &Path {
|
||||
self.deref()
|
||||
}
|
||||
}
|
||||
|
||||
impl ToOwned for Path {
|
||||
type Owned = PathBuf;
|
||||
fn to_owned(&self) -> PathBuf { self.to_path_buf() }
|
||||
}
|
||||
|
||||
impl cmp::PartialEq for PathBuf {
|
||||
fn eq(&self, other: &PathBuf) -> bool {
|
||||
self.components() == other.components()
|
||||
|
@ -1066,10 +1070,10 @@ impl Path {
|
|||
self.inner.to_str()
|
||||
}
|
||||
|
||||
/// Convert a `Path` to a `CowString`.
|
||||
/// Convert a `Path` to a `Cow<str>`.
|
||||
///
|
||||
/// Any non-Unicode sequences are replaced with U+FFFD REPLACEMENT CHARACTER.
|
||||
pub fn to_string_lossy(&self) -> CowString {
|
||||
pub fn to_string_lossy(&self) -> Cow<str> {
|
||||
self.inner.to_string_lossy()
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue