@@ -318,20 +318,6 @@ pub(super) fn find_opaque_ty_constraints_for_rpit<'tcx>(
318
318
319
319
let mir_opaque_ty = tcx. mir_borrowck ( owner_def_id) . concrete_opaque_types . get ( & def_id) . copied ( ) ;
320
320
if let Some ( mir_opaque_ty) = mir_opaque_ty {
321
- if mir_opaque_ty. references_error ( ) {
322
- return mir_opaque_ty. ty ;
323
- }
324
-
325
- debug ! ( ?owner_def_id) ;
326
- let mut locator = RpitConstraintChecker { def_id, tcx, found : mir_opaque_ty } ;
327
-
328
- match tcx. hir_node_by_def_id ( owner_def_id) {
329
- Node :: Item ( it) => intravisit:: walk_item ( & mut locator, it) ,
330
- Node :: ImplItem ( it) => intravisit:: walk_impl_item ( & mut locator, it) ,
331
- Node :: TraitItem ( it) => intravisit:: walk_trait_item ( & mut locator, it) ,
332
- other => bug ! ( "{:?} is not a valid scope for an opaque type item" , other) ,
333
- }
334
-
335
321
mir_opaque_ty. ty
336
322
} else if let Some ( guar) = tables. tainted_by_errors {
337
323
// Some error in the owner fn prevented us from populating
@@ -352,61 +338,3 @@ pub(super) fn find_opaque_ty_constraints_for_rpit<'tcx>(
352
338
}
353
339
}
354
340
}
355
-
356
- struct RpitConstraintChecker < ' tcx > {
357
- tcx : TyCtxt < ' tcx > ,
358
-
359
- /// def_id of the opaque type whose defining uses are being checked
360
- def_id : LocalDefId ,
361
-
362
- found : ty:: OpaqueHiddenType < ' tcx > ,
363
- }
364
-
365
- impl RpitConstraintChecker < ' _ > {
366
- #[ instrument( skip( self ) , level = "debug" ) ]
367
- fn check ( & self , def_id : LocalDefId ) {
368
- // Use borrowck to get the type with unerased regions.
369
- let concrete_opaque_types = & self . tcx . mir_borrowck ( def_id) . concrete_opaque_types ;
370
- debug ! ( ?concrete_opaque_types) ;
371
- if let Some ( & concrete_type) = concrete_opaque_types. get ( & self . def_id ) {
372
- debug ! ( ?concrete_type, "found constraint" ) ;
373
- if concrete_type. ty != self . found . ty {
374
- if let Ok ( d) = self . found . build_mismatch_error ( & concrete_type, self . tcx ) {
375
- d. emit ( ) ;
376
- }
377
- }
378
- }
379
- }
380
- }
381
-
382
- impl < ' tcx > intravisit:: Visitor < ' tcx > for RpitConstraintChecker < ' tcx > {
383
- type NestedFilter = nested_filter:: OnlyBodies ;
384
-
385
- fn maybe_tcx ( & mut self ) -> Self :: MaybeTyCtxt {
386
- self . tcx
387
- }
388
- fn visit_expr ( & mut self , ex : & ' tcx Expr < ' tcx > ) {
389
- intravisit:: walk_expr ( self , ex) ;
390
- }
391
- fn visit_item ( & mut self , it : & ' tcx Item < ' tcx > ) {
392
- trace ! ( ?it. owner_id) ;
393
- // The opaque type itself or its children are not within its reveal scope.
394
- if it. owner_id . def_id != self . def_id {
395
- self . check ( it. owner_id . def_id ) ;
396
- intravisit:: walk_item ( self , it) ;
397
- }
398
- }
399
- fn visit_impl_item ( & mut self , it : & ' tcx ImplItem < ' tcx > ) {
400
- trace ! ( ?it. owner_id) ;
401
- // The opaque type itself or its children are not within its reveal scope.
402
- if it. owner_id . def_id != self . def_id {
403
- self . check ( it. owner_id . def_id ) ;
404
- intravisit:: walk_impl_item ( self , it) ;
405
- }
406
- }
407
- fn visit_trait_item ( & mut self , it : & ' tcx TraitItem < ' tcx > ) {
408
- trace ! ( ?it. owner_id) ;
409
- self . check ( it. owner_id . def_id ) ;
410
- intravisit:: walk_trait_item ( self , it) ;
411
- }
412
- }
0 commit comments