1
Fork 0

Auto merge of #72767 - pnkfelix:track-devirtualized-filenames-issue-70924, r=eddyb

Track devirtualized filenames

Split payload of FileName::Real to track both real and virtualized paths.

(Such splits arise from metadata refs into libstd; the virtualized paths look like `/rustc/1.45.0/src/libstd/io/cursor.rs` rather than `/Users/felixklock/Dev/Mozilla/rust.git/src/libstd/io/cursor.rs`)

This way, we can emit the virtual name into things like the like the StableSourceFileId (as was done back before PR #70642) that ends up in incremental build artifacts, while still using the devirtualized file path when we want to access the file.

Fix #70924
This commit is contained in:
bors 2020-05-31 17:14:44 +00:00
commit 5fd2f06e99
14 changed files with 130 additions and 41 deletions

View file

@ -473,7 +473,7 @@ pub fn run(
} = options;
let src_root = match krate.src {
FileName::Real(ref p) => match p.parent() {
FileName::Real(ref p) => match p.local_path().parent() {
Some(p) => p.to_path_buf(),
None => PathBuf::new(),
},
@ -1621,9 +1621,10 @@ impl Context {
// We can safely ignore synthetic `SourceFile`s.
let file = match item.source.filename {
FileName::Real(ref path) => path,
FileName::Real(ref path) => path.local_path().to_path_buf(),
_ => return None,
};
let file = &file;
let (krate, path) = if item.source.cnum == LOCAL_CRATE {
if let Some(path) = self.shared.local_sources.get(file) {