@@ -6,7 +6,6 @@ use rustc_data_structures::fx::FxHashSet;
6
6
use rustc_data_structures::sync::Lrc;
7
7
use rustc_hir::def_id::{CRATE_DEF_ID, LocalDefId};
8
8
use rustc_hir::{self as hir, CRATE_HIR_ID, intravisit};
9
- use rustc_middle::hir::map::Map;
10
9
use rustc_middle::hir::nested_filter;
11
10
use rustc_middle::ty::TyCtxt;
12
11
use rustc_resolve::rustdoc::span_of_fragments;
@@ -63,27 +62,21 @@ impl DocTestVisitor for RustCollector {
63
62
}
64
63
65
64
pub(super) struct HirCollector<'tcx> {
66
- map: Map<'tcx>,
67
65
codes: ErrorCodes,
68
66
tcx: TyCtxt<'tcx>,
69
67
enable_per_target_ignores: bool,
70
68
collector: RustCollector,
71
69
}
72
70
73
71
impl<'tcx> HirCollector<'tcx> {
74
- pub fn new(
75
- map: Map<'tcx>,
76
- codes: ErrorCodes,
77
- enable_per_target_ignores: bool,
78
- tcx: TyCtxt<'tcx>,
79
- ) -> Self {
72
+ pub fn new(codes: ErrorCodes, enable_per_target_ignores: bool, tcx: TyCtxt<'tcx>) -> Self {
80
73
let collector = RustCollector {
81
74
source_map: tcx.sess.psess.clone_source_map(),
82
75
cur_path: vec![],
83
76
position: DUMMY_SP,
84
77
tests: vec![],
85
78
};
86
- Self { map, codes, enable_per_target_ignores, tcx, collector }
79
+ Self { codes, enable_per_target_ignores, tcx, collector }
87
80
}
88
81
89
82
pub fn collect_crate(mut self) -> Vec<ScrapedDocTest> {
@@ -142,13 +135,13 @@ impl<'tcx> intravisit::Visitor<'tcx> for HirCollector<'tcx> {
142
135
type NestedFilter = nested_filter::All;
143
136
144
137
fn nested_visit_map(&mut self) -> Self::Map {
145
- self.map
138
+ self.tcx.hir()
146
139
}
147
140
148
141
fn visit_item(&mut self, item: &'tcx hir::Item<'_>) {
149
142
let name = match &item.kind {
150
143
hir::ItemKind::Impl(impl_) => {
151
- rustc_hir_pretty::id_to_string(&self.map , impl_.self_ty.hir_id)
144
+ rustc_hir_pretty::id_to_string(&self.tcx.hir() , impl_.self_ty.hir_id)
152
145
}
153
146
_ => item.ident.to_string(),
154
147
};
0 commit comments