1
+ use crate :: hir:: map:: Map ;
1
2
use crate :: ty:: TyCtxt ;
2
- /* use rustc_data_structures::fx::FxHashSet;
3
+ use rustc_data_structures:: fx:: FxHashSet ;
3
4
use rustc_data_structures:: sync:: { par_iter, Lock , ParallelIterator } ;
4
5
use rustc_hir as hir;
5
6
use rustc_hir:: def_id:: { DefId , DefIndex , CRATE_DEF_INDEX } ;
6
7
use rustc_hir:: intravisit;
7
8
use rustc_hir:: itemlikevisit:: ItemLikeVisitor ;
8
- use rustc_hir::{HirId, ItemLocalId};*/
9
+ use rustc_hir:: { HirId , ItemLocalId } ;
9
10
10
- pub fn check_crate ( _tcx : TyCtxt < ' _ > ) {
11
- /* tcx.dep_graph.assert_ignored();
11
+ pub fn check_crate ( tcx : TyCtxt < ' _ > ) {
12
+ tcx. dep_graph . assert_ignored ( ) ;
12
13
13
14
let errors = Lock :: new ( Vec :: new ( ) ) ;
15
+ let hir_map = tcx. hir ( ) ;
14
16
15
- par_iter(&hir_map.krate.modules).for_each(|(module_id, _)| {
17
+ par_iter ( & hir_map. krate ( ) . modules ) . for_each ( |( module_id, _) | {
16
18
let local_def_id = hir_map. local_def_id ( * module_id) ;
17
19
hir_map. visit_item_likes_in_module (
18
20
local_def_id,
@@ -25,23 +27,23 @@ pub fn check_crate(_tcx: TyCtxt<'_>) {
25
27
if !errors. is_empty ( ) {
26
28
let message = errors. iter ( ) . fold ( String :: new ( ) , |s1, s2| s1 + "\n " + s2) ;
27
29
tcx. sess . delay_span_bug ( rustc_span:: DUMMY_SP , & message) ;
28
- }*/
30
+ }
29
31
}
30
- /*
32
+
31
33
struct HirIdValidator < ' a , ' hir > {
32
- hir_map: &'a EarlyMap <'hir>,
34
+ hir_map : Map < ' hir > ,
33
35
owner_def_index : Option < DefIndex > ,
34
36
hir_ids_seen : FxHashSet < ItemLocalId > ,
35
37
errors : & ' a Lock < Vec < String > > ,
36
38
}
37
39
38
40
struct OuterVisitor < ' a , ' hir > {
39
- hir_map: &'a EarlyMap <'hir>,
41
+ hir_map : Map < ' hir > ,
40
42
errors : & ' a Lock < Vec < String > > ,
41
43
}
42
44
43
45
impl < ' a , ' hir > OuterVisitor < ' a , ' hir > {
44
- fn new_inner_visitor(&self, hir_map: &'a EarlyMap <'hir>) -> HirIdValidator<'a, 'hir> {
46
+ fn new_inner_visitor ( & self , hir_map : Map < ' hir > ) -> HirIdValidator < ' a , ' hir > {
45
47
HirIdValidator {
46
48
hir_map,
47
49
owner_def_index : None ,
@@ -133,7 +135,7 @@ impl<'a, 'hir> HirIdValidator<'a, 'hir> {
133
135
}
134
136
135
137
impl < ' a , ' hir > intravisit:: Visitor < ' hir > for HirIdValidator < ' a , ' hir > {
136
- type Map = EarlyMap <'hir>;
138
+ type Map = Map < ' hir > ;
137
139
138
140
fn nested_visit_map ( & mut self ) -> intravisit:: NestedVisitorMap < Self :: Map > {
139
141
intravisit:: NestedVisitorMap :: OnlyBodies ( self . hir_map )
@@ -173,4 +175,3 @@ impl<'a, 'hir> intravisit::Visitor<'hir> for HirIdValidator<'a, 'hir> {
173
175
// different owner.
174
176
}
175
177
}
176
- */
0 commit comments