about summary refs log tree commit diff
path: root/src/libsyntax_pos
diff options
context:
space:
mode:
authorPhilip Craig <philipjcraig@gmail.com>2017-10-03 19:44:58 +1000
committerPhilip Craig <philipjcraig@gmail.com>2017-10-03 19:47:33 +1000
commit3a225c77bba8576333924e7435493cb4d4e0cbaf (patch)
tree5c2d2bf700d90f2f9f7507997f876937dc9ab805 /src/libsyntax_pos
parentc27a82f19352f37a6b04d7733d28c84494c3afd4 (diff)
downloadrust-3a225c77bba8576333924e7435493cb4d4e0cbaf.tar.gz
rust-3a225c77bba8576333924e7435493cb4d4e0cbaf.zip
Rename FileMap::path and change to an Option
Diffstat (limited to 'src/libsyntax_pos')
-rw-r--r--src/libsyntax_pos/lib.rs11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/libsyntax_pos/lib.rs b/src/libsyntax_pos/lib.rs
index 0d910cc04f6..2000db9703c 100644
--- a/src/libsyntax_pos/lib.rs
+++ b/src/libsyntax_pos/lib.rs
@@ -502,8 +502,9 @@ pub struct FileMap {
     pub name: FileName,
     /// True if the `name` field above has been modified by -Zremap-path-prefix
     pub name_was_remapped: bool,
-    /// The path of the file that the source came from.
-    pub path: PathBuf,
+    /// The unmapped path of the file that the source came from.
+    /// Set to `None` if the FileMap was imported from an external crate.
+    pub unmapped_path: Option<PathBuf>,
     /// Indicates which crate this FileMap was imported from.
     pub crate_of_origin: u32,
     /// The complete source code
@@ -629,7 +630,7 @@ impl Decodable for FileMap {
             Ok(FileMap {
                 name,
                 name_was_remapped,
-                path: PathBuf::new(),
+                unmapped_path: None,
                 // `crate_of_origin` has to be set by the importer.
                 // This value matches up with rustc::hir::def_id::INVALID_CRATE.
                 // That constant is not available here unfortunately :(
@@ -655,7 +656,7 @@ impl fmt::Debug for FileMap {
 impl FileMap {
     pub fn new(name: FileName,
                name_was_remapped: bool,
-               path: PathBuf,
+               unmapped_path: PathBuf,
                mut src: String,
                start_pos: BytePos) -> FileMap {
         remove_bom(&mut src);
@@ -669,7 +670,7 @@ impl FileMap {
         FileMap {
             name,
             name_was_remapped,
-            path,
+            unmapped_path: Some(unmapped_path),
             crate_of_origin: 0,
             src: Some(Rc::new(src)),
             src_hash,