@@ -30,7 +30,6 @@ use rustc::ty::{self, Ty, TyCtxt};
3030use rustc:: ty:: maps:: Providers ;
3131use rustc:: ty:: subst:: Substs ;
3232use rustc:: hir;
33- use rustc:: hir:: intravisit:: { Visitor , NestedVisitorMap } ;
3433use syntax:: abi:: Abi ;
3534use syntax:: ast;
3635use syntax_pos:: Span ;
@@ -39,9 +38,11 @@ use std::cell::RefCell;
3938use std:: mem;
4039
4140pub 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+ } ) ;
4546}
4647
4748pub fn provide ( providers : & mut Providers ) {
@@ -180,23 +181,6 @@ impl<'a, 'gcx: 'tcx, 'tcx> MutVisitor<'tcx> for GlobalizeMir<'a, 'gcx> {
180181///////////////////////////////////////////////////////////////////////////
181182// BuildMir -- walks a crate, looking for fn items and methods to build MIR from
182183
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-
200184fn closure_self_ty < ' a , ' tcx > ( tcx : TyCtxt < ' a , ' tcx , ' tcx > ,
201185 closure_expr_id : ast:: NodeId ,
202186 body_id : hir:: BodyId )
0 commit comments