@@ -184,22 +184,24 @@ where
184
184
}
185
185
}
186
186
187
- fn check_well_formed ( tcx : TyCtxt < ' _ > , def_id : hir :: OwnerId ) -> Result < ( ) , ErrorGuaranteed > {
188
- let node = tcx. hir_owner_node ( def_id) ;
187
+ fn check_well_formed ( tcx : TyCtxt < ' _ > , def_id : LocalDefId ) -> Result < ( ) , ErrorGuaranteed > {
188
+ let node = tcx. hir_node_by_def_id ( def_id) ;
189
189
let mut res = match node {
190
- hir:: OwnerNode :: Crate ( _) => bug ! ( "check_well_formed cannot be applied to the crate root" ) ,
191
- hir:: OwnerNode :: Item ( item) => check_item ( tcx, item) ,
192
- hir:: OwnerNode :: TraitItem ( item) => check_trait_item ( tcx, item) ,
193
- hir:: OwnerNode :: ImplItem ( item) => check_impl_item ( tcx, item) ,
194
- hir:: OwnerNode :: ForeignItem ( item) => check_foreign_item ( tcx, item) ,
195
- hir:: OwnerNode :: Synthetic => unreachable ! ( ) ,
190
+ hir:: Node :: Crate ( _) => bug ! ( "check_well_formed cannot be applied to the crate root" ) ,
191
+ hir:: Node :: Item ( item) => check_item ( tcx, item) ,
192
+ hir:: Node :: TraitItem ( item) => check_trait_item ( tcx, item) ,
193
+ hir:: Node :: ImplItem ( item) => check_impl_item ( tcx, item) ,
194
+ hir:: Node :: ForeignItem ( item) => check_foreign_item ( tcx, item) ,
195
+ hir:: Node :: OpaqueTy ( _) => Ok ( crate :: check:: check:: check_item_type ( tcx, def_id) ) ,
196
+ _ => unreachable ! ( ) ,
196
197
} ;
197
198
198
199
if let Some ( generics) = node. generics ( ) {
199
200
for param in generics. params {
200
201
res = res. and ( check_param_wf ( tcx, param) ) ;
201
202
}
202
203
}
204
+
203
205
res
204
206
}
205
207
@@ -2119,10 +2121,14 @@ impl<'tcx> WfCheckingCtxt<'_, 'tcx> {
2119
2121
2120
2122
fn check_mod_type_wf ( tcx : TyCtxt < ' _ > , module : LocalModDefId ) -> Result < ( ) , ErrorGuaranteed > {
2121
2123
let items = tcx. hir_module_items ( module) ;
2122
- let mut res = items. par_items ( |item| tcx. ensure ( ) . check_well_formed ( item. owner_id ) ) ;
2123
- res = res. and ( items. par_impl_items ( |item| tcx. ensure ( ) . check_well_formed ( item. owner_id ) ) ) ;
2124
- res = res. and ( items. par_trait_items ( |item| tcx. ensure ( ) . check_well_formed ( item. owner_id ) ) ) ;
2125
- res = res. and ( items. par_foreign_items ( |item| tcx. ensure ( ) . check_well_formed ( item. owner_id ) ) ) ;
2124
+ let mut res = items. par_items ( |item| tcx. ensure ( ) . check_well_formed ( item. owner_id . def_id ) ) ;
2125
+ res =
2126
+ res. and ( items. par_impl_items ( |item| tcx. ensure ( ) . check_well_formed ( item. owner_id . def_id ) ) ) ;
2127
+ res =
2128
+ res. and ( items. par_trait_items ( |item| tcx. ensure ( ) . check_well_formed ( item. owner_id . def_id ) ) ) ;
2129
+ res = res
2130
+ . and ( items. par_foreign_items ( |item| tcx. ensure ( ) . check_well_formed ( item. owner_id . def_id ) ) ) ;
2131
+ res = res. and ( items. par_opaques ( |item| tcx. ensure ( ) . check_well_formed ( item) ) ) ;
2126
2132
if module == LocalModDefId :: CRATE_DEF_ID {
2127
2133
super :: entry:: check_for_entry_fn ( tcx) ;
2128
2134
}
0 commit comments