@@ -39,14 +39,10 @@ struct CoherenceChecker<'a, 'tcx: 'a> {
39
39
tcx : TyCtxt < ' a , ' tcx , ' tcx > ,
40
40
}
41
41
42
- struct CoherenceCheckVisitor < ' a , ' tcx : ' a > {
43
- cc : & ' a CoherenceChecker < ' a , ' tcx > ,
44
- }
45
-
46
- impl < ' a , ' tcx , ' v > ItemLikeVisitor < ' v > for CoherenceCheckVisitor < ' a , ' tcx > {
42
+ impl < ' a , ' tcx , ' v > ItemLikeVisitor < ' v > for CoherenceChecker < ' a , ' tcx > {
47
43
fn visit_item ( & mut self , item : & Item ) {
48
44
if let ItemImpl ( ..) = item. node {
49
- self . cc . check_implementation ( item)
45
+ self . check_implementation ( item)
50
46
}
51
47
}
52
48
@@ -81,14 +77,11 @@ impl<'a, 'tcx> CoherenceChecker<'a, 'tcx> {
81
77
}
82
78
}
83
79
84
- fn check ( & self ) {
80
+ fn check ( & mut self ) {
85
81
// Check implementations and traits. This populates the tables
86
82
// containing the inherent methods and extension methods. It also
87
83
// builds up the trait inheritance table.
88
- self . tcx . visit_all_item_likes_in_krate (
89
- DepNode :: CoherenceCheckImpl ,
90
- & mut CoherenceCheckVisitor { cc : self } ) ;
91
- builtin:: check ( self . tcx ) ;
84
+ self . tcx . visit_all_item_likes_in_krate ( DepNode :: CoherenceCheckImpl , self ) ;
92
85
}
93
86
94
87
fn check_implementation ( & self , item : & Item ) {
@@ -174,4 +167,5 @@ pub fn check_coherence(ccx: &CrateCtxt) {
174
167
unsafety:: check ( ccx. tcx ) ;
175
168
orphan:: check ( ccx. tcx ) ;
176
169
overlap:: check ( ccx. tcx ) ;
170
+ builtin:: check ( ccx. tcx ) ;
177
171
}
0 commit comments