Make local_path in RealFileName::Remapped Option to be removed in exported metadata
This commit is contained in:
parent
6720a37042
commit
9e0426d784
11 changed files with 123 additions and 52 deletions
|
@ -1073,7 +1073,9 @@ impl<'a> ExtCtxt<'a> {
|
|||
if !path.is_absolute() {
|
||||
let callsite = span.source_callsite();
|
||||
let mut result = match self.source_map().span_to_filename(callsite) {
|
||||
FileName::Real(name) => name.into_local_path(),
|
||||
FileName::Real(name) => name
|
||||
.into_local_path()
|
||||
.expect("attempting to resolve a file path in an external file"),
|
||||
FileName::DocTest(path, _) => path,
|
||||
other => {
|
||||
return Err(self.struct_span_err(
|
||||
|
|
|
@ -362,7 +362,9 @@ impl<'a, 'b> MacroExpander<'a, 'b> {
|
|||
// make crate a first class expansion target instead.
|
||||
pub fn expand_crate(&mut self, mut krate: ast::Crate) -> ast::Crate {
|
||||
let file_path = match self.cx.source_map().span_to_filename(krate.span) {
|
||||
FileName::Real(name) => name.into_local_path(),
|
||||
FileName::Real(name) => name
|
||||
.into_local_path()
|
||||
.expect("attempting to resolve a file path in an external file"),
|
||||
other => PathBuf::from(other.to_string()),
|
||||
};
|
||||
let dir_path = file_path.parent().unwrap_or(&file_path).to_owned();
|
||||
|
|
|
@ -623,6 +623,7 @@ impl server::SourceFile for Rustc<'_> {
|
|||
match file.name {
|
||||
FileName::Real(ref name) => name
|
||||
.local_path()
|
||||
.expect("attempting to get a file path in an imported file in `proc_macro::SourceFile::path`")
|
||||
.to_str()
|
||||
.expect("non-UTF8 file path in `proc_macro::SourceFile::path`")
|
||||
.to_string(),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue