diff options
| author | Philip Craig <philipjcraig@gmail.com> | 2017-09-30 16:28:48 +1000 |
|---|---|---|
| committer | Philip Craig <philipjcraig@gmail.com> | 2017-09-30 16:32:45 +1000 |
| commit | c27a82f19352f37a6b04d7733d28c84494c3afd4 (patch) | |
| tree | d132f77d9e61fe3d4d13d6ee2bafd887e7c5b942 /src/libsyntax_pos | |
| parent | 46ef6208f8a3dd0629a9d6c592c2a980e52c9bee (diff) | |
| download | rust-c27a82f19352f37a6b04d7733d28c84494c3afd4.tar.gz rust-c27a82f19352f37a6b04d7733d28c84494c3afd4.zip | |
Don't use remapped path when loading modules and include files
Diffstat (limited to 'src/libsyntax_pos')
| -rw-r--r-- | src/libsyntax_pos/lib.rs | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/libsyntax_pos/lib.rs b/src/libsyntax_pos/lib.rs index 582f2798181..0d910cc04f6 100644 --- a/src/libsyntax_pos/lib.rs +++ b/src/libsyntax_pos/lib.rs @@ -32,6 +32,7 @@ use std::cmp::{self, Ordering}; use std::fmt; use std::hash::Hasher; use std::ops::{Add, Sub}; +use std::path::PathBuf; use std::rc::Rc; use rustc_data_structures::stable_hasher::StableHasher; @@ -501,6 +502,8 @@ 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, /// Indicates which crate this FileMap was imported from. pub crate_of_origin: u32, /// The complete source code @@ -626,6 +629,7 @@ impl Decodable for FileMap { Ok(FileMap { name, name_was_remapped, + path: PathBuf::new(), // `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 :( @@ -651,6 +655,7 @@ impl fmt::Debug for FileMap { impl FileMap { pub fn new(name: FileName, name_was_remapped: bool, + path: PathBuf, mut src: String, start_pos: BytePos) -> FileMap { remove_bom(&mut src); @@ -664,6 +669,7 @@ impl FileMap { FileMap { name, name_was_remapped, + path, crate_of_origin: 0, src: Some(Rc::new(src)), src_hash, |
