Use local and remapped paths where appropriate
This commit is contained in:
parent
fb4f6439f6
commit
5417b45c26
28 changed files with 85 additions and 74 deletions
|
@ -305,6 +305,16 @@ impl FileName {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn prefer_remapped(&self) -> FileNameDisplay<'_> {
|
||||
FileNameDisplay { inner: self, prefer_local: false }
|
||||
}
|
||||
|
||||
// This may include transient local filesystem information.
|
||||
// Must not be embedded in build outputs.
|
||||
pub fn prefer_local(&self) -> FileNameDisplay<'_> {
|
||||
FileNameDisplay { inner: self, prefer_local: true }
|
||||
}
|
||||
|
||||
pub fn macro_expansion_source_code(src: &str) -> FileName {
|
||||
let mut hasher = StableHasher::new();
|
||||
src.hash(&mut hasher);
|
||||
|
|
|
@ -369,11 +369,6 @@ impl SourceMap {
|
|||
source_file
|
||||
}
|
||||
|
||||
pub fn mk_substr_filename(&self, sp: Span) -> String {
|
||||
let pos = self.lookup_char_pos(sp.lo());
|
||||
format!("<{}:{}:{}>", pos.file.name, pos.line, pos.col.to_usize() + 1)
|
||||
}
|
||||
|
||||
// If there is a doctest offset, applies it to the line.
|
||||
pub fn doctest_offset_line(&self, file: &FileName, orig: usize) -> usize {
|
||||
match file {
|
||||
|
@ -420,7 +415,7 @@ impl SourceMap {
|
|||
let hi = self.lookup_char_pos(sp.hi());
|
||||
format!(
|
||||
"{}:{}:{}: {}:{}",
|
||||
lo.file.name,
|
||||
lo.file.name.prefer_remapped(),
|
||||
lo.line,
|
||||
lo.col.to_usize() + 1,
|
||||
hi.line,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue