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
|
@ -1080,7 +1080,10 @@ impl<'a> ExtCtxt<'a> {
|
|||
other => {
|
||||
return Err(self.struct_span_err(
|
||||
span,
|
||||
&format!("cannot resolve relative path in non-file source `{}`", other),
|
||||
&format!(
|
||||
"cannot resolve relative path in non-file source `{}`",
|
||||
other.prefer_local()
|
||||
),
|
||||
));
|
||||
}
|
||||
};
|
||||
|
|
|
@ -365,7 +365,7 @@ impl<'a, 'b> MacroExpander<'a, 'b> {
|
|||
FileName::Real(name) => name
|
||||
.into_local_path()
|
||||
.expect("attempting to resolve a file path in an external file"),
|
||||
other => PathBuf::from(other.to_string()),
|
||||
other => PathBuf::from(other.prefer_local().to_string()),
|
||||
};
|
||||
let dir_path = file_path.parent().unwrap_or(&file_path).to_owned();
|
||||
self.cx.root_path = dir_path.clone();
|
||||
|
|
|
@ -627,7 +627,7 @@ impl server::SourceFile for Rustc<'_> {
|
|||
.to_str()
|
||||
.expect("non-UTF8 file path in `proc_macro::SourceFile::path`")
|
||||
.to_string(),
|
||||
_ => file.name.to_string(),
|
||||
_ => file.name.prefer_local().to_string(),
|
||||
}
|
||||
}
|
||||
fn is_real(&mut self, file: &Self::SourceFile) -> bool {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue