@@ -1185,8 +1185,7 @@ fn find_existential_constraints<'a, 'tcx>(
1185
1185
found : Option < ( Span , ty:: Ty < ' tcx > ) > ,
1186
1186
}
1187
1187
impl < ' a , ' tcx > ConstraintLocator < ' a , ' tcx > {
1188
- fn check ( & mut self , node_id : ast:: NodeId ) {
1189
- let def_id = self . tcx . hir . local_def_id ( node_id) ;
1188
+ fn check ( & mut self , def_id : DefId ) {
1190
1189
// don't try to check items that cannot possibly constrain the type
1191
1190
if !self . tcx . has_typeck_tables ( def_id) {
1192
1191
return ;
@@ -1221,21 +1220,24 @@ fn find_existential_constraints<'a, 'tcx>(
1221
1220
intravisit:: NestedVisitorMap :: All ( & self . tcx . hir )
1222
1221
}
1223
1222
fn visit_item ( & mut self , it : & ' tcx Item ) {
1223
+ let def_id = self . tcx . hir . local_def_id ( it. id ) ;
1224
1224
// the existential type itself or its children are not within its reveal scope
1225
- if self . tcx . hir . local_def_id ( it . id ) != self . def_id {
1226
- self . check ( it . id ) ;
1225
+ if def_id != self . def_id {
1226
+ self . check ( def_id ) ;
1227
1227
intravisit:: walk_item ( self , it) ;
1228
1228
}
1229
1229
}
1230
1230
fn visit_impl_item ( & mut self , it : & ' tcx ImplItem ) {
1231
+ let def_id = self . tcx . hir . local_def_id ( it. id ) ;
1231
1232
// the existential type itself or its children are not within its reveal scope
1232
- if self . tcx . hir . local_def_id ( it . id ) != self . def_id {
1233
- self . check ( it . id ) ;
1233
+ if def_id != self . def_id {
1234
+ self . check ( def_id ) ;
1234
1235
intravisit:: walk_impl_item ( self , it) ;
1235
1236
}
1236
1237
}
1237
1238
fn visit_trait_item ( & mut self , it : & ' tcx TraitItem ) {
1238
- self . check ( it. id ) ;
1239
+ let def_id = self . tcx . hir . local_def_id ( it. id ) ;
1240
+ self . check ( def_id) ;
1239
1241
intravisit:: walk_trait_item ( self , it) ;
1240
1242
}
1241
1243
}
0 commit comments