diff options
| author | bors <bors@rust-lang.org> | 2020-06-01 15:42:51 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2020-06-01 15:42:51 +0000 |
| commit | 49cae55760da0a43428eba73abcb659bb70cf2e4 (patch) | |
| tree | 4aaa1c51870e6e83fda6d1c86d6bac54457ab89b /src/librustc_expand | |
| parent | 02c25b359e667d2eba0da4d9e75408d675b7a4d5 (diff) | |
| parent | 68a0acd6341440bd6ae6e0b612f558b10e6d522f (diff) | |
| download | rust-1.44.0.tar.gz rust-1.44.0.zip | |
Auto merge of #72883 - Mark-Simulacrum:stable-next, r=Mark-Simulacrum 1.44.0
[stable] 1.44 release This includes a release notes update as usual and a backport of #72767. r? @ghost
Diffstat (limited to 'src/librustc_expand')
| -rw-r--r-- | src/librustc_expand/base.rs | 2 | ||||
| -rw-r--r-- | src/librustc_expand/expand.rs | 2 | ||||
| -rw-r--r-- | src/librustc_expand/module.rs | 5 | ||||
| -rw-r--r-- | src/librustc_expand/proc_macro_server.rs | 3 |
4 files changed, 7 insertions, 5 deletions
diff --git a/src/librustc_expand/base.rs b/src/librustc_expand/base.rs index 59c1a5468f1..bbd6bb47fb8 100644 --- a/src/librustc_expand/base.rs +++ b/src/librustc_expand/base.rs @@ -1086,7 +1086,7 @@ impl<'a> ExtCtxt<'a> { if !path.is_absolute() { let callsite = span.source_callsite(); let mut result = match self.source_map().span_to_unmapped_path(callsite) { - FileName::Real(path) => path, + FileName::Real(name) => name.into_local_path(), FileName::DocTest(path, _) => path, other => { return Err(self.struct_span_err( diff --git a/src/librustc_expand/expand.rs b/src/librustc_expand/expand.rs index 2618c758ca5..39058d229d5 100644 --- a/src/librustc_expand/expand.rs +++ b/src/librustc_expand/expand.rs @@ -340,7 +340,7 @@ impl<'a, 'b> MacroExpander<'a, 'b> { let mut module = ModuleData { mod_path: vec![Ident::from_str(&self.cx.ecfg.crate_name)], directory: match self.cx.source_map().span_to_unmapped_path(krate.span) { - FileName::Real(path) => path, + FileName::Real(name) => name.into_local_path(), other => PathBuf::from(other.to_string()), }, }; diff --git a/src/librustc_expand/module.rs b/src/librustc_expand/module.rs index aad92a09743..acf986445e5 100644 --- a/src/librustc_expand/module.rs +++ b/src/librustc_expand/module.rs @@ -71,7 +71,7 @@ crate fn parse_external_mod( // Extract the directory path for submodules of `module`. let path = sess.source_map().span_to_unmapped_path(module.inner); let mut path = match path { - FileName::Real(path) => path, + FileName::Real(name) => name.into_local_path(), other => PathBuf::from(other.to_string()), }; path.pop(); @@ -189,7 +189,8 @@ fn error_cannot_declare_mod_here<'a, T>( let mut err = sess.span_diagnostic.struct_span_err(span, "cannot declare a new module at this location"); if !span.is_dummy() { - if let FileName::Real(src_path) = sess.source_map().span_to_filename(span) { + if let FileName::Real(src_name) = sess.source_map().span_to_filename(span) { + let src_path = src_name.into_local_path(); if let Some(stem) = src_path.file_stem() { let mut dest_path = src_path.clone(); dest_path.set_file_name(stem); diff --git a/src/librustc_expand/proc_macro_server.rs b/src/librustc_expand/proc_macro_server.rs index 5f21ff503d5..b26f9caf456 100644 --- a/src/librustc_expand/proc_macro_server.rs +++ b/src/librustc_expand/proc_macro_server.rs @@ -596,7 +596,8 @@ impl server::SourceFile for Rustc<'_> { } fn path(&mut self, file: &Self::SourceFile) -> String { match file.name { - FileName::Real(ref path) => path + FileName::Real(ref name) => name + .local_path() .to_str() .expect("non-UTF8 file path in `proc_macro::SourceFile::path`") .to_string(), |
