@@ -185,22 +185,24 @@ where
185
185
}
186
186
}
187
187
188
- fn check_well_formed ( tcx : TyCtxt < ' _ > , def_id : hir :: OwnerId ) -> Result < ( ) , ErrorGuaranteed > {
189
- let node = tcx. hir_owner_node ( def_id) ;
188
+ fn check_well_formed ( tcx : TyCtxt < ' _ > , def_id : LocalDefId ) -> Result < ( ) , ErrorGuaranteed > {
189
+ let node = tcx. hir_node_by_def_id ( def_id) ;
190
190
let mut res = match node {
191
- hir:: OwnerNode :: Crate ( _) => bug ! ( "check_well_formed cannot be applied to the crate root" ) ,
192
- hir:: OwnerNode :: Item ( item) => check_item ( tcx, item) ,
193
- hir:: OwnerNode :: TraitItem ( item) => check_trait_item ( tcx, item) ,
194
- hir:: OwnerNode :: ImplItem ( item) => check_impl_item ( tcx, item) ,
195
- hir:: OwnerNode :: ForeignItem ( item) => check_foreign_item ( tcx, item) ,
196
- hir:: OwnerNode :: Synthetic => unreachable ! ( ) ,
191
+ hir:: Node :: Crate ( _) => bug ! ( "check_well_formed cannot be applied to the crate root" ) ,
192
+ hir:: Node :: Item ( item) => check_item ( tcx, item) ,
193
+ hir:: Node :: TraitItem ( item) => check_trait_item ( tcx, item) ,
194
+ hir:: Node :: ImplItem ( item) => check_impl_item ( tcx, item) ,
195
+ hir:: Node :: ForeignItem ( item) => check_foreign_item ( tcx, item) ,
196
+ hir:: Node :: OpaqueTy ( _) => Ok ( crate :: check:: check:: check_item_type ( tcx, def_id) ) ,
197
+ _ => unreachable ! ( ) ,
197
198
} ;
198
199
199
200
if let Some ( generics) = node. generics ( ) {
200
201
for param in generics. params {
201
202
res = res. and ( check_param_wf ( tcx, param) ) ;
202
203
}
203
204
}
205
+
204
206
res
205
207
}
206
208
@@ -2172,10 +2174,14 @@ impl<'tcx> WfCheckingCtxt<'_, 'tcx> {
2172
2174
2173
2175
fn check_mod_type_wf ( tcx : TyCtxt < ' _ > , module : LocalModDefId ) -> Result < ( ) , ErrorGuaranteed > {
2174
2176
let items = tcx. hir_module_items ( module) ;
2175
- let mut res = items. par_items ( |item| tcx. ensure ( ) . check_well_formed ( item. owner_id ) ) ;
2176
- res = res. and ( items. par_impl_items ( |item| tcx. ensure ( ) . check_well_formed ( item. owner_id ) ) ) ;
2177
- res = res. and ( items. par_trait_items ( |item| tcx. ensure ( ) . check_well_formed ( item. owner_id ) ) ) ;
2178
- res = res. and ( items. par_foreign_items ( |item| tcx. ensure ( ) . check_well_formed ( item. owner_id ) ) ) ;
2177
+ let mut res = items. par_items ( |item| tcx. ensure ( ) . check_well_formed ( item. owner_id . def_id ) ) ;
2178
+ res =
2179
+ res. and ( items. par_impl_items ( |item| tcx. ensure ( ) . check_well_formed ( item. owner_id . def_id ) ) ) ;
2180
+ res =
2181
+ res. and ( items. par_trait_items ( |item| tcx. ensure ( ) . check_well_formed ( item. owner_id . def_id ) ) ) ;
2182
+ res = res
2183
+ . and ( items. par_foreign_items ( |item| tcx. ensure ( ) . check_well_formed ( item. owner_id . def_id ) ) ) ;
2184
+ res = res. and ( items. par_opaques ( |item| tcx. ensure ( ) . check_well_formed ( item) ) ) ;
2179
2185
if module == LocalModDefId :: CRATE_DEF_ID {
2180
2186
super :: entry:: check_for_entry_fn ( tcx) ;
2181
2187
}
0 commit comments