diff options
| author | Vadim Petrochenkov <vadim.petrochenkov@gmail.com> | 2022-11-25 17:39:38 +0300 |
|---|---|---|
| committer | Vadim Petrochenkov <vadim.petrochenkov@gmail.com> | 2022-12-01 18:51:05 +0300 |
| commit | 1f259ae6799e7e0a08e5b84fc5686e404b17eef0 (patch) | |
| tree | 388417f61bf1eb19e633f3e613353f01c05b8730 /compiler/rustc_save_analysis/src | |
| parent | 6cd4dd3091dfe0ce4a728bd9ae177361fba23736 (diff) | |
| download | rust-1f259ae6799e7e0a08e5b84fc5686e404b17eef0.tar.gz rust-1f259ae6799e7e0a08e5b84fc5686e404b17eef0.zip | |
rustc_hir: Change representation of import paths to support multiple resolutions
Diffstat (limited to 'compiler/rustc_save_analysis/src')
| -rw-r--r-- | compiler/rustc_save_analysis/src/dump_visitor.rs | 4 | ||||
| -rw-r--r-- | compiler/rustc_save_analysis/src/lib.rs | 4 |
2 files changed, 5 insertions, 3 deletions
diff --git a/compiler/rustc_save_analysis/src/dump_visitor.rs b/compiler/rustc_save_analysis/src/dump_visitor.rs index fae20c2ba5f..b4528853825 100644 --- a/compiler/rustc_save_analysis/src/dump_visitor.rs +++ b/compiler/rustc_save_analysis/src/dump_visitor.rs @@ -185,13 +185,13 @@ impl<'tcx> DumpVisitor<'tcx> { } } - fn write_sub_paths(&mut self, path: &'tcx hir::Path<'tcx>) { + fn write_sub_paths<R>(&mut self, path: &'tcx hir::Path<'tcx, R>) { self.write_segments(path.segments) } // As write_sub_paths, but does not process the last ident in the path (assuming it // will be processed elsewhere). See note on write_sub_paths about global. - fn write_sub_paths_truncated(&mut self, path: &'tcx hir::Path<'tcx>) { + fn write_sub_paths_truncated<R>(&mut self, path: &'tcx hir::Path<'tcx, R>) { if let [segments @ .., _] = path.segments { self.write_segments(segments) } diff --git a/compiler/rustc_save_analysis/src/lib.rs b/compiler/rustc_save_analysis/src/lib.rs index 4fa0c14715e..f05eb2b7432 100644 --- a/compiler/rustc_save_analysis/src/lib.rs +++ b/compiler/rustc_save_analysis/src/lib.rs @@ -594,7 +594,9 @@ impl<'tcx> SaveContext<'tcx> { match self.tcx.hir().get(hir_id) { Node::TraitRef(tr) => tr.path.res, - Node::Item(&hir::Item { kind: hir::ItemKind::Use(path, _), .. }) => path.res, + Node::Item(&hir::Item { kind: hir::ItemKind::Use(path, _), .. }) => { + path.res.get(0).copied().unwrap_or(Res::Err) + } Node::PathSegment(seg) => { if seg.res != Res::Err { seg.res |
