@@ -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 } ;
@@ -540,18 +540,26 @@ pub fn check_item_types<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) -> CompileResult
540
540
541
541
pub fn check_item_bodies < ' a , ' tcx > ( tcx : TyCtxt < ' a , ' tcx , ' tcx > ) -> CompileResult {
542
542
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
543
545
tcx. dep_graph . with_task ( DepNode :: TypeckBodiesKrate , tcx, ( ) , check_item_bodies_task) ;
544
546
} ) ;
545
547
546
548
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 )
550
550
}
551
551
}
552
552
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
+
553
560
pub fn provide ( providers : & mut Providers ) {
554
561
* providers = Providers {
562
+ typeck_item_bodies,
555
563
typeck_tables,
556
564
closure_type,
557
565
closure_kind,
0 commit comments