@@ -14,7 +14,7 @@ use rustc_hir::{ItemKind, Node, PathSegment};
14
14
use rustc_infer:: infer:: opaque_types:: ConstrainOpaqueTypeRegionVisitor ;
15
15
use rustc_infer:: infer:: outlives:: env:: OutlivesEnvironment ;
16
16
use rustc_infer:: infer:: { DefiningAnchor , RegionVariableOrigin , TyCtxtInferExt } ;
17
- use rustc_infer:: traits:: { Obligation , TraitEngineExt as _ } ;
17
+ use rustc_infer:: traits:: Obligation ;
18
18
use rustc_lint:: builtin:: REPR_TRANSPARENT_EXTERNAL_PRIVATE_FIELDS ;
19
19
use rustc_middle:: hir:: nested_filter;
20
20
use rustc_middle:: middle:: stability:: EvalResult ;
@@ -28,7 +28,7 @@ use rustc_span::{self, Span};
28
28
use rustc_target:: spec:: abi:: Abi ;
29
29
use rustc_trait_selection:: traits:: error_reporting:: on_unimplemented:: OnUnimplementedDirective ;
30
30
use rustc_trait_selection:: traits:: error_reporting:: TypeErrCtxtExt as _;
31
- use rustc_trait_selection:: traits:: { self , ObligationCtxt , TraitEngine , TraitEngineExt as _ } ;
31
+ use rustc_trait_selection:: traits:: { self , ObligationCtxt } ;
32
32
33
33
use std:: ops:: ControlFlow ;
34
34
@@ -1460,8 +1460,7 @@ fn opaque_type_cycle_error(
1460
1460
for def_id in visitor. opaques {
1461
1461
let ty_span = tcx. def_span ( def_id) ;
1462
1462
if !seen. contains ( & ty_span) {
1463
- let descr = if ty. is_impl_trait ( ) { "opaque " } else { "" } ;
1464
- err. span_label ( ty_span, & format ! ( "returning this {descr}type `{ty}`" ) ) ;
1463
+ err. span_label ( ty_span, & format ! ( "returning this opaque type `{ty}`" ) ) ;
1465
1464
seen. insert ( ty_span) ;
1466
1465
}
1467
1466
err. span_label ( sp, & format ! ( "returning here with type `{ty}`" ) ) ;
@@ -1508,34 +1507,3 @@ fn opaque_type_cycle_error(
1508
1507
}
1509
1508
err. emit ( )
1510
1509
}
1511
-
1512
- pub ( super ) fn check_generator_obligations ( tcx : TyCtxt < ' _ > , def_id : LocalDefId ) {
1513
- debug_assert ! ( tcx. sess. opts. unstable_opts. drop_tracking_mir) ;
1514
- debug_assert ! ( matches!( tcx. def_kind( def_id) , DefKind :: Generator ) ) ;
1515
-
1516
- let typeck = tcx. typeck ( def_id) ;
1517
- let param_env = tcx. param_env ( def_id) ;
1518
-
1519
- let generator_interior_predicates = & typeck. generator_interior_predicates [ & def_id] ;
1520
- debug ! ( ?generator_interior_predicates) ;
1521
-
1522
- let infcx = tcx
1523
- . infer_ctxt ( )
1524
- // typeck writeback gives us predicates with their regions erased.
1525
- // As borrowck already has checked lifetimes, we do not need to do it again.
1526
- . ignoring_regions ( )
1527
- // Bind opaque types to `def_id` as they should have been checked by borrowck.
1528
- . with_opaque_type_inference ( DefiningAnchor :: Bind ( def_id) )
1529
- . build ( ) ;
1530
-
1531
- let mut fulfillment_cx = <dyn TraitEngine < ' _ > >:: new ( infcx. tcx ) ;
1532
- for ( predicate, cause) in generator_interior_predicates {
1533
- let obligation = Obligation :: new ( tcx, cause. clone ( ) , param_env, * predicate) ;
1534
- fulfillment_cx. register_predicate_obligation ( & infcx, obligation) ;
1535
- }
1536
- let errors = fulfillment_cx. select_all_or_error ( & infcx) ;
1537
- debug ! ( ?errors) ;
1538
- if !errors. is_empty ( ) {
1539
- infcx. err_ctxt ( ) . report_fulfillment_errors ( & errors, None ) ;
1540
- }
1541
- }
0 commit comments