diff options
| author | Oli Scherer <git-spam-no-reply9815368754983@oli-obk.de> | 2022-12-07 09:24:00 +0000 |
|---|---|---|
| committer | Oli Scherer <git-spam-no-reply9815368754983@oli-obk.de> | 2023-01-16 14:46:44 +0000 |
| commit | 9f5cd0315386e761beae8afd07df94e42a4db154 (patch) | |
| tree | 6e64a92962daa43d7eb93fc072225d8e9ee79e6b /compiler/rustc_save_analysis/src | |
| parent | 42f75f1e462f90bfe20f458690113c3cb2a26271 (diff) | |
| download | rust-9f5cd0315386e761beae8afd07df94e42a4db154.tar.gz rust-9f5cd0315386e761beae8afd07df94e42a4db154.zip | |
Move compiler input and ouput paths into session
Diffstat (limited to 'compiler/rustc_save_analysis/src')
| -rw-r--r-- | compiler/rustc_save_analysis/src/dump_visitor.rs | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/compiler/rustc_save_analysis/src/dump_visitor.rs b/compiler/rustc_save_analysis/src/dump_visitor.rs index 9ae07cb005b..a5f09de1c40 100644 --- a/compiler/rustc_save_analysis/src/dump_visitor.rs +++ b/compiler/rustc_save_analysis/src/dump_visitor.rs @@ -112,9 +112,7 @@ impl<'tcx> DumpVisitor<'tcx> { } pub fn dump_crate_info(&mut self, name: Symbol) { - let source_file = self.tcx.sess.local_crate_source_file.as_ref(); - let crate_root = source_file.map(|source_file| { - let source_file = Path::new(source_file); + let crate_root = self.tcx.sess.local_crate_source_file().map(|source_file| { match source_file.file_name() { Some(_) => source_file.parent().unwrap().display(), None => source_file.display(), @@ -157,10 +155,14 @@ impl<'tcx> DumpVisitor<'tcx> { .enumerate() .filter(|(i, _)| !remap_arg_indices.contains(i)) .map(|(_, arg)| match input { - Input::File(ref path) if path == Path::new(&arg) => { - let mapped = &self.tcx.sess.local_crate_source_file; - mapped.as_ref().unwrap().to_string_lossy().into() - } + Input::File(ref path) if path == Path::new(&arg) => self + .tcx + .sess + .local_crate_source_file() + .as_ref() + .unwrap() + .to_string_lossy() + .into(), _ => arg, }); |
