@@ -53,6 +53,23 @@ use rustc::hir::intravisit::{self, Visitor, NestedVisitorMap};
53
53
use std:: collections:: hash_map:: Entry ;
54
54
use std:: cmp:: Ordering ;
55
55
56
+ pub fn check_crate < ' a , ' tcx > ( tcx : TyCtxt < ' a , ' tcx , ' tcx > ) {
57
+ for & body_id in & tcx. hir . krate ( ) . body_ids {
58
+ let visitor = & mut CheckCrateVisitor {
59
+ tcx,
60
+ tables : & ty:: TypeckTables :: empty ( None ) ,
61
+ in_fn : false ,
62
+ in_static : false ,
63
+ promotable : false ,
64
+ mut_rvalue_borrows : NodeSet ( ) ,
65
+ param_env : ty:: ParamEnv :: empty ( Reveal :: UserFacing ) ,
66
+ identity_substs : Substs :: empty ( ) ,
67
+ } ;
68
+ visitor. visit_nested_body ( body_id) ;
69
+ }
70
+ tcx. sess . abort_if_errors ( ) ;
71
+ }
72
+
56
73
struct CheckCrateVisitor < ' a , ' tcx : ' a > {
57
74
tcx : TyCtxt < ' a , ' tcx , ' tcx > ,
58
75
in_fn : bool ,
@@ -513,20 +530,6 @@ fn check_adjustments<'a, 'tcx>(v: &mut CheckCrateVisitor<'a, 'tcx>, e: &hir::Exp
513
530
}
514
531
}
515
532
516
- pub fn check_crate < ' a , ' tcx > ( tcx : TyCtxt < ' a , ' tcx , ' tcx > ) {
517
- tcx. hir . krate ( ) . visit_all_item_likes ( & mut CheckCrateVisitor {
518
- tcx,
519
- tables : & ty:: TypeckTables :: empty ( None ) ,
520
- in_fn : false ,
521
- in_static : false ,
522
- promotable : false ,
523
- mut_rvalue_borrows : NodeSet ( ) ,
524
- param_env : ty:: ParamEnv :: empty ( Reveal :: UserFacing ) ,
525
- identity_substs : Substs :: empty ( ) ,
526
- } . as_deep_visitor ( ) ) ;
527
- tcx. sess . abort_if_errors ( ) ;
528
- }
529
-
530
533
impl < ' a , ' gcx , ' tcx > euv:: Delegate < ' tcx > for CheckCrateVisitor < ' a , ' gcx > {
531
534
fn consume ( & mut self ,
532
535
_consume_id : ast:: NodeId ,
0 commit comments