@@ -28,7 +28,7 @@ use rustc::util::common::ErrorReported;
28
28
29
29
use rustc:: hir:: def:: * ;
30
30
use rustc:: hir:: def_id:: DefId ;
31
- use rustc:: hir:: intravisit:: { self , Visitor , FnKind , NestedVisitorMap } ;
31
+ use rustc:: hir:: intravisit:: { self , Visitor , NestedVisitorMap } ;
32
32
use rustc:: hir:: { self , Pat , PatKind } ;
33
33
34
34
use rustc_back:: slice;
@@ -44,47 +44,11 @@ impl<'a, 'tcx> Visitor<'tcx> for OuterVisitor<'a, 'tcx> {
44
44
NestedVisitorMap :: OnlyBodies ( & self . tcx . hir )
45
45
}
46
46
47
- fn visit_fn ( & mut self , fk : FnKind < ' tcx > , fd : & ' tcx hir:: FnDecl ,
48
- b : hir:: BodyId , s : Span , id : ast:: NodeId ) {
49
- intravisit:: walk_fn ( self , fk, fd, b, s, id) ;
50
-
51
- check_body ( self . tcx , b) ;
52
- }
53
-
54
- fn visit_item ( & mut self , item : & ' tcx hir:: Item ) {
55
- intravisit:: walk_item ( self , item) ;
56
- match item. node {
57
- hir:: ItemStatic ( .., body_id) | hir:: ItemConst ( .., body_id) => {
58
- check_body ( self . tcx , body_id) ;
59
- }
60
- _ => ( ) ,
61
- }
62
- }
63
-
64
- fn visit_impl_item ( & mut self , ii : & ' tcx hir:: ImplItem ) {
65
- intravisit:: walk_impl_item ( self , ii) ;
66
- if let hir:: ImplItemKind :: Const ( _, body_id) = ii. node {
67
- check_body ( self . tcx , body_id) ;
68
- }
69
- }
70
-
71
- fn visit_trait_item ( & mut self , ti : & ' tcx hir:: TraitItem ) {
72
- intravisit:: walk_trait_item ( self , ti) ;
73
- if let hir:: TraitItemKind :: Const ( _, Some ( body_id) ) = ti. node {
74
- check_body ( self . tcx , body_id) ;
75
- }
47
+ fn visit_body ( & mut self , body : & ' tcx hir:: Body ) {
48
+ intravisit:: walk_body ( self , body) ;
49
+ let def_id = self . tcx . hir . body_owner_def_id ( body. id ( ) ) ;
50
+ let _ = self . tcx . check_match ( def_id) ;
76
51
}
77
-
78
- // Enum variants and types (e.g. `[T; { .. }]`) may have bodies too,
79
- // but they are const-evaluated during typeck.
80
- }
81
-
82
- fn check_body < ' a , ' tcx > (
83
- tcx : TyCtxt < ' a , ' tcx , ' tcx > ,
84
- body_id : hir:: BodyId ,
85
- ) {
86
- let def_id = tcx. hir . body_owner_def_id ( body_id) ;
87
- let _ = tcx. check_match ( def_id) ;
88
52
}
89
53
90
54
pub fn check_crate < ' a , ' tcx > ( tcx : TyCtxt < ' a , ' tcx , ' tcx > ) {
0 commit comments