Remove proc_macro2::FileName in favor of PathBuf
diff --git a/src/lib.rs b/src/lib.rs
index 2f632f6..4f8f59d 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -58,6 +58,8 @@
 use std::hash::{Hash, Hasher};
 use std::iter::FromIterator;
 use std::marker;
+#[cfg(procmacro2_semver_exempt)]
+use std::path::PathBuf;
 use std::rc::Rc;
 use std::str::FromStr;
 
@@ -211,10 +213,6 @@
     }
 }
 
-// Returned by reference, so we can't easily wrap it.
-#[cfg(procmacro2_semver_exempt)]
-pub use imp::FileName;
-
 /// The source file of a given `Span`.
 ///
 /// This type is semver exempt and not exposed by default.
@@ -237,7 +235,7 @@
     /// may not actually be valid.
     ///
     /// [`is_real`]: #method.is_real
-    pub fn path(&self) -> &FileName {
+    pub fn path(&self) -> PathBuf {
         self.0.path()
     }
 
@@ -249,13 +247,6 @@
 }
 
 #[cfg(procmacro2_semver_exempt)]
-impl AsRef<FileName> for SourceFile {
-    fn as_ref(&self) -> &FileName {
-        self.0.path()
-    }
-}
-
-#[cfg(procmacro2_semver_exempt)]
 impl fmt::Debug for SourceFile {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
         self.0.fmt(f)
diff --git a/src/stable.rs b/src/stable.rs
index 0d8aac9..baeed69 100644
--- a/src/stable.rs
+++ b/src/stable.rs
@@ -6,6 +6,9 @@
 use std::cmp;
 use std::fmt;
 use std::iter;
+#[cfg(procmacro2_semver_exempt)]
+use std::path::Path;
+use std::path::PathBuf;
 use std::str::FromStr;
 use std::vec;
 
@@ -190,29 +193,15 @@
     }
 }
 
-#[derive(Clone, PartialEq, Eq, Debug)]
-pub struct FileName(String);
-
-#[allow(dead_code)]
-pub fn file_name(s: String) -> FileName {
-    FileName(s)
-}
-
-impl fmt::Display for FileName {
-    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
-        self.0.fmt(f)
-    }
-}
-
 #[derive(Clone, PartialEq, Eq)]
 pub struct SourceFile {
-    name: FileName,
+    path: PathBuf,
 }
 
 impl SourceFile {
     /// Get the path to this source file as a string.
-    pub fn path(&self) -> &FileName {
-        &self.name
+    pub fn path(&self) -> PathBuf {
+        self.path.clone()
     }
 
     pub fn is_real(&self) -> bool {
@@ -221,12 +210,6 @@
     }
 }
 
-impl AsRef<FileName> for SourceFile {
-    fn as_ref(&self) -> &FileName {
-        self.path()
-    }
-}
-
 impl fmt::Debug for SourceFile {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
         f.debug_struct("SourceFile")
@@ -382,7 +365,7 @@
             let cm = cm.borrow();
             let fi = cm.fileinfo(*self);
             SourceFile {
-                name: FileName(fi.name.clone()),
+                path: Path::new(&fi.name).to_owned(),
             }
         })
     }
diff --git a/src/unstable.rs b/src/unstable.rs
index d15b9da..c4cf11a 100644
--- a/src/unstable.rs
+++ b/src/unstable.rs
@@ -3,6 +3,8 @@
 use std::fmt;
 use std::iter;
 use std::panic::{self, PanicInfo};
+#[cfg(super_unstable)]
+use std::path::PathBuf;
 use std::str::FromStr;
 
 use proc_macro;
@@ -382,52 +384,40 @@
     }
 }
 
-pub use stable::FileName;
-
-// NOTE: We have to generate our own filename object here because we can't wrap
-// the one provided by proc_macro.
 #[derive(Clone, PartialEq, Eq)]
 #[cfg(super_unstable)]
 pub enum SourceFile {
-    Nightly(proc_macro::SourceFile, FileName),
+    Nightly(proc_macro::SourceFile),
     Stable(stable::SourceFile),
 }
 
 #[cfg(super_unstable)]
 impl SourceFile {
     fn nightly(sf: proc_macro::SourceFile) -> Self {
-        let filename = stable::file_name(sf.path().display().to_string());
-        SourceFile::Nightly(sf, filename)
+        SourceFile::Nightly(sf)
     }
 
     /// Get the path to this source file as a string.
-    pub fn path(&self) -> &FileName {
+    pub fn path(&self) -> PathBuf {
         match self {
-            SourceFile::Nightly(_, f) => f,
+            SourceFile::Nightly(a) => a.path(),
             SourceFile::Stable(a) => a.path(),
         }
     }
 
     pub fn is_real(&self) -> bool {
         match self {
-            SourceFile::Nightly(a, _) => a.is_real(),
+            SourceFile::Nightly(a) => a.is_real(),
             SourceFile::Stable(a) => a.is_real(),
         }
     }
 }
 
 #[cfg(super_unstable)]
-impl AsRef<FileName> for SourceFile {
-    fn as_ref(&self) -> &FileName {
-        self.path()
-    }
-}
-
-#[cfg(super_unstable)]
 impl fmt::Debug for SourceFile {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
         match self {
-            SourceFile::Nightly(a, _) => a.fmt(f),
+            SourceFile::Nightly(a) => a.fmt(f),
             SourceFile::Stable(a) => a.fmt(f),
         }
     }
diff --git a/tests/test.rs b/tests/test.rs
index 5d2fb85..9d37cf3 100644
--- a/tests/test.rs
+++ b/tests/test.rs
@@ -203,7 +203,7 @@
     assert_eq!(end.line, 1);
     assert_eq!(end.column, 0);
     let source_file = Span::call_site().source_file();
-    assert_eq!(source_file.path().to_string(), "<unspecified>");
+    assert_eq!(source_file.path().to_string_lossy(), "<unspecified>");
     assert!(!source_file.is_real());
 }