@@ -30,7 +30,6 @@ use rustc::ty::{self, Ty, TyCtxt};
30
30
use rustc:: ty:: maps:: Providers ;
31
31
use rustc:: ty:: subst:: Substs ;
32
32
use rustc:: hir;
33
- use rustc:: hir:: intravisit:: { Visitor , NestedVisitorMap } ;
34
33
use syntax:: abi:: Abi ;
35
34
use syntax:: ast;
36
35
use syntax_pos:: Span ;
@@ -39,9 +38,11 @@ use std::cell::RefCell;
39
38
use std:: mem;
40
39
41
40
pub fn build_mir_for_crate < ' a , ' tcx > ( tcx : TyCtxt < ' a , ' tcx , ' tcx > ) {
42
- tcx. visit_all_item_likes_in_krate ( DepNode :: Mir , & mut BuildMir {
43
- tcx : tcx
44
- } . as_deep_visitor ( ) ) ;
41
+ tcx. dep_graph . with_task ( DepNode :: MirKrate , || {
42
+ tcx. visit_all_bodies_in_krate ( |body_owner_def_id, _body_id| {
43
+ tcx. item_mir ( body_owner_def_id) ;
44
+ } ) ;
45
+ } ) ;
45
46
}
46
47
47
48
pub fn provide ( providers : & mut Providers ) {
@@ -180,23 +181,6 @@ impl<'a, 'gcx: 'tcx, 'tcx> MutVisitor<'tcx> for GlobalizeMir<'a, 'gcx> {
180
181
///////////////////////////////////////////////////////////////////////////
181
182
// BuildMir -- walks a crate, looking for fn items and methods to build MIR from
182
183
183
- struct BuildMir < ' a , ' tcx : ' a > {
184
- tcx : TyCtxt < ' a , ' tcx , ' tcx >
185
- }
186
-
187
- impl < ' a , ' tcx > Visitor < ' tcx > for BuildMir < ' a , ' tcx > {
188
- fn nested_visit_map < ' this > ( & ' this mut self ) -> NestedVisitorMap < ' this , ' tcx > {
189
- NestedVisitorMap :: None
190
- }
191
-
192
- fn visit_nested_body ( & mut self , body_id : hir:: BodyId ) {
193
- self . tcx . item_mir ( self . tcx . hir . body_owner_def_id ( body_id) ) ;
194
-
195
- let body = self . tcx . hir . body ( body_id) ;
196
- self . visit_body ( body) ;
197
- }
198
- }
199
-
200
184
fn closure_self_ty < ' a , ' tcx > ( tcx : TyCtxt < ' a , ' tcx , ' tcx > ,
201
185
closure_expr_id : ast:: NodeId ,
202
186
body_id : hir:: BodyId )
0 commit comments