From a4b7ed7a42c716ab9f05e351f003d589124fd55d Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 17 Apr 2024 14:18:58 +0200 Subject: Adding upstream version 1.68.2+dfsg1. Signed-off-by: Daniel Baumann --- compiler/rustc_save_analysis/src/dump_visitor.rs | 16 +++++++++------- compiler/rustc_save_analysis/src/lib.rs | 9 ++++----- compiler/rustc_save_analysis/src/sig.rs | 2 +- compiler/rustc_save_analysis/src/span_utils.rs | 8 +------- 4 files changed, 15 insertions(+), 20 deletions(-) (limited to 'compiler/rustc_save_analysis') diff --git a/compiler/rustc_save_analysis/src/dump_visitor.rs b/compiler/rustc_save_analysis/src/dump_visitor.rs index 9ae07cb00..a5f09de1c 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, }); diff --git a/compiler/rustc_save_analysis/src/lib.rs b/compiler/rustc_save_analysis/src/lib.rs index 7735c5713..a8d82de02 100644 --- a/compiler/rustc_save_analysis/src/lib.rs +++ b/compiler/rustc_save_analysis/src/lib.rs @@ -36,7 +36,6 @@ use rustc_span::symbol::Ident; use rustc_span::*; use std::cell::Cell; -use std::default::Default; use std::env; use std::fs::File; use std::io::BufWriter; @@ -601,7 +600,7 @@ impl<'tcx> SaveContext<'tcx> { if seg.res != Res::Err { seg.res } else { - let parent_node = self.tcx.hir().get_parent_node(hir_id); + let parent_node = self.tcx.hir().parent_id(hir_id); self.get_path_res(parent_node) } } @@ -958,10 +957,10 @@ impl SaveHandler for CallbackHandler<'_> { } } -pub fn process_crate<'l, 'tcx, H: SaveHandler>( - tcx: TyCtxt<'tcx>, +pub fn process_crate( + tcx: TyCtxt<'_>, cratename: Symbol, - input: &'l Input, + input: &Input, config: Option, mut handler: H, ) { diff --git a/compiler/rustc_save_analysis/src/sig.rs b/compiler/rustc_save_analysis/src/sig.rs index 9197a28c1..5a1bcb8fd 100644 --- a/compiler/rustc_save_analysis/src/sig.rs +++ b/compiler/rustc_save_analysis/src/sig.rs @@ -165,7 +165,7 @@ impl<'hir> Sig for hir::Ty<'hir> { let text = format!("{}{}", prefix, nested.text); Ok(replace_text(nested, text)) } - hir::TyKind::Rptr(ref lifetime, ref mt) => { + hir::TyKind::Ref(ref lifetime, ref mt) => { let mut prefix = "&".to_owned(); prefix.push_str(&lifetime.ident.to_string()); prefix.push(' '); diff --git a/compiler/rustc_save_analysis/src/span_utils.rs b/compiler/rustc_save_analysis/src/span_utils.rs index 8d6758f40..e65d57bb3 100644 --- a/compiler/rustc_save_analysis/src/span_utils.rs +++ b/compiler/rustc_save_analysis/src/span_utils.rs @@ -18,13 +18,7 @@ impl<'a> SpanUtils<'a> { match &file.name { FileName::Real(RealFileName::LocalPath(path)) => { if path.is_absolute() { - self.sess - .source_map() - .path_mapping() - .map_prefix(path.into()) - .0 - .display() - .to_string() + self.sess.source_map().path_mapping().map_prefix(path).0.display().to_string() } else { self.sess .opts -- cgit v1.2.3