Don't use remapped path when loading modules and include files
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user