Skip to content

Commit

Permalink
Rollup merge of rust-lang#50401 - alexcrichton:remove-path-from-str, …
Browse files Browse the repository at this point in the history
…r=sfackler

Revert "Implement FromStr for PathBuf"

This reverts commit 05a9acc.

The libs team was discussing rust-lang#44431 today and the changes originally added in rust-lang#48292 and the conclusion was that we'd like to revert this for now until `!` is stable. This'll provide us maximal flexibility to tweak the error type here in the future, and it looks like `!` is close-ish to stabilization so hopefully this won't be delayed for too long.
  • Loading branch information
kennytm committed May 3, 2018
2 parents 46bc2c2 + f684147 commit cd6fa5f
Showing 1 changed file with 0 additions and 27 deletions.
27 changes: 0 additions & 27 deletions src/libstd/path.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,6 @@ use io;
use iter::{self, FusedIterator};
use ops::{self, Deref};
use rc::Rc;
use str::FromStr;
use sync::Arc;

use ffi::{OsStr, OsString};
Expand Down Expand Up @@ -1441,32 +1440,6 @@ impl From<String> for PathBuf {
}
}

/// Error returned from [`PathBuf::from_str`][`from_str`].
///
/// Note that parsing a path will never fail. This error is just a placeholder
/// for implementing `FromStr` for `PathBuf`.
///
/// [`from_str`]: struct.PathBuf.html#method.from_str
#[derive(Debug, Clone, PartialEq, Eq)]
#[stable(feature = "path_from_str", since = "1.26.0")]
pub enum ParsePathError {}

#[stable(feature = "path_from_str", since = "1.26.0")]
impl fmt::Display for ParsePathError {
fn fmt(&self, _: &mut fmt::Formatter) -> fmt::Result {
match *self {}
}
}

#[stable(feature = "path_from_str", since = "1.26.0")]
impl FromStr for PathBuf {
type Err = ParsePathError;

fn from_str(s: &str) -> Result<Self, Self::Err> {
Ok(PathBuf::from(s))
}
}

#[stable(feature = "rust1", since = "1.0.0")]
impl<P: AsRef<Path>> iter::FromIterator<P> for PathBuf {
fn from_iter<I: IntoIterator<Item = P>>(iter: I) -> PathBuf {
Expand Down

0 comments on commit cd6fa5f

Please sign in to comment.