@@ -84,7 +84,7 @@ use astconv::AstConv;
84
84
use dep_graph:: DepNode ;
85
85
use fmt_macros:: { Parser , Piece , Position } ;
86
86
use hir:: def:: { Def , CtorKind } ;
87
- use hir:: def_id:: { DefId , LOCAL_CRATE } ;
87
+ use hir:: def_id:: { CrateNum , DefId , LOCAL_CRATE } ;
88
88
use rustc:: infer:: { self , InferCtxt , InferOk , RegionVariableOrigin , TypeTrace } ;
89
89
use rustc:: infer:: type_variable:: { self , TypeVariableOrigin } ;
90
90
use rustc:: ty:: subst:: { Kind , Subst , Substs } ;
@@ -542,18 +542,26 @@ pub fn check_item_types<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) -> CompileResult
542
542
543
543
pub fn check_item_bodies < ' a , ' tcx > ( tcx : TyCtxt < ' a , ' tcx , ' tcx > ) -> CompileResult {
544
544
return tcx. sess . track_errors ( || {
545
+ // FIXME(cramertj): This `with_task` should be removed once there is a task for
546
+ // typeck or for the compilation as a whole
545
547
tcx. dep_graph . with_task ( DepNode :: TypeckBodiesKrate , tcx, ( ) , check_item_bodies_task) ;
546
548
} ) ;
547
549
548
550
fn check_item_bodies_task < ' a , ' tcx > ( tcx : TyCtxt < ' a , ' tcx , ' tcx > , ( ) : ( ) ) {
549
- tcx. visit_all_bodies_in_krate ( |body_owner_def_id, _body_id| {
550
- tcx. item_tables ( body_owner_def_id) ;
551
- } ) ;
551
+ ty:: queries:: typeck_item_bodies:: get ( tcx, DUMMY_SP , LOCAL_CRATE )
552
552
}
553
553
}
554
554
555
+ fn typeck_item_bodies < ' a , ' tcx > ( tcx : TyCtxt < ' a , ' tcx , ' tcx > , crate_num : CrateNum ) {
556
+ debug_assert ! ( crate_num == LOCAL_CRATE ) ;
557
+ tcx. visit_all_bodies_in_krate ( |body_owner_def_id, _body_id| {
558
+ tcx. item_tables ( body_owner_def_id) ;
559
+ } ) ;
560
+ }
561
+
555
562
pub fn provide ( providers : & mut Providers ) {
556
563
* providers = Providers {
564
+ typeck_item_bodies,
557
565
typeck_tables,
558
566
closure_type,
559
567
closure_kind,
0 commit comments