@@ -84,7 +84,7 @@ use astconv::AstConv;
8484use dep_graph:: DepNode ;
8585use fmt_macros:: { Parser , Piece , Position } ;
8686use hir:: def:: { Def , CtorKind } ;
87- use hir:: def_id:: { DefId , LOCAL_CRATE } ;
87+ use hir:: def_id:: { CrateNum , DefId , LOCAL_CRATE } ;
8888use rustc:: infer:: { self , InferCtxt , InferOk , RegionVariableOrigin , TypeTrace } ;
8989use rustc:: infer:: type_variable:: { self , TypeVariableOrigin } ;
9090use rustc:: ty:: subst:: { Kind , Subst , Substs } ;
@@ -540,18 +540,26 @@ pub fn check_item_types<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) -> CompileResult
540540
541541pub fn check_item_bodies < ' a , ' tcx > ( tcx : TyCtxt < ' a , ' tcx , ' tcx > ) -> CompileResult {
542542 return tcx. sess . track_errors ( || {
543+ // FIXME(cramertj): This `with_task` should be removed once there is a task for
544+ // typeck or for the compilation as a whole
543545 tcx. dep_graph . with_task ( DepNode :: TypeckBodiesKrate , tcx, ( ) , check_item_bodies_task) ;
544546 } ) ;
545547
546548 fn check_item_bodies_task < ' a , ' tcx > ( tcx : TyCtxt < ' a , ' tcx , ' tcx > , ( ) : ( ) ) {
547- tcx. visit_all_bodies_in_krate ( |body_owner_def_id, _body_id| {
548- tcx. item_tables ( body_owner_def_id) ;
549- } ) ;
549+ ty:: queries:: typeck_item_bodies:: get ( tcx, DUMMY_SP , LOCAL_CRATE )
550550 }
551551}
552552
553+ fn typeck_item_bodies < ' a , ' tcx > ( tcx : TyCtxt < ' a , ' tcx , ' tcx > , crate_num : CrateNum ) {
554+ debug_assert ! ( crate_num == LOCAL_CRATE ) ;
555+ tcx. visit_all_bodies_in_krate ( |body_owner_def_id, _body_id| {
556+ tcx. item_tables ( body_owner_def_id) ;
557+ } ) ;
558+ }
559+
553560pub fn provide ( providers : & mut Providers ) {
554561 * providers = Providers {
562+ typeck_item_bodies,
555563 typeck_tables,
556564 closure_type,
557565 closure_kind,
0 commit comments