@@ -243,7 +243,7 @@ pub struct InferCtxt<'tcx> {
243
243
pub tcx : TyCtxt < ' tcx > ,
244
244
245
245
/// The `DefIds` of the opaque types that may have their hidden types constrained.
246
- defining_opaque_types : ty:: OpaqueTypes < ' tcx > ,
246
+ defining_opaque_types : & ' tcx ty:: List < LocalDefId > ,
247
247
248
248
/// Whether this inference context should care about region obligations in
249
249
/// the root universe. Most notably, this is used during hir typeck as region
@@ -370,7 +370,7 @@ impl<'tcx> ty::InferCtxtLike for InferCtxt<'tcx> {
370
370
self . inner . borrow_mut ( ) . unwrap_region_constraints ( ) . opportunistic_resolve_var ( self . tcx , vid)
371
371
}
372
372
373
- fn defining_opaque_types ( & self ) -> ty:: OpaqueTypes < ' tcx > {
373
+ fn defining_opaque_types ( & self ) -> & ' tcx ty:: List < LocalDefId > {
374
374
self . defining_opaque_types
375
375
}
376
376
@@ -620,7 +620,7 @@ impl fmt::Display for FixupError {
620
620
/// Used to configure inference contexts before their creation.
621
621
pub struct InferCtxtBuilder < ' tcx > {
622
622
tcx : TyCtxt < ' tcx > ,
623
- defining_opaque_types : ty:: OpaqueTypes < ' tcx > ,
623
+ defining_opaque_types : & ' tcx ty:: List < LocalDefId > ,
624
624
considering_regions : bool ,
625
625
skip_leak_check : bool ,
626
626
/// Whether we are in coherence mode.
@@ -635,7 +635,7 @@ impl<'tcx> TyCtxt<'tcx> {
635
635
fn infer_ctxt ( self ) -> InferCtxtBuilder < ' tcx > {
636
636
InferCtxtBuilder {
637
637
tcx : self ,
638
- defining_opaque_types : Default :: default ( ) ,
638
+ defining_opaque_types : ty :: List :: empty ( ) ,
639
639
considering_regions : true ,
640
640
skip_leak_check : false ,
641
641
intercrate : false ,
@@ -651,14 +651,14 @@ impl<'tcx> InferCtxtBuilder<'tcx> {
651
651
/// It is only meant to be called in two places, for typeck
652
652
/// (via `Inherited::build`) and for the inference context used
653
653
/// in mir borrowck.
654
- pub fn with_opaque_type_inference ( self , defining_anchor : LocalDefId ) -> Self {
655
- let defining_opaque_types = self . tcx . opaque_types_defined_by ( defining_anchor) ;
656
- self . with_defining_opaque_types ( defining_opaque_types )
654
+ pub fn with_opaque_type_inference ( mut self , defining_anchor : LocalDefId ) -> Self {
655
+ self . defining_opaque_types = self . tcx . opaque_types_defined_by ( defining_anchor) ;
656
+ self
657
657
}
658
658
659
659
pub fn with_defining_opaque_types (
660
660
mut self ,
661
- defining_opaque_types : ty:: OpaqueTypes < ' tcx > ,
661
+ defining_opaque_types : & ' tcx ty:: List < LocalDefId > ,
662
662
) -> Self {
663
663
self . defining_opaque_types = defining_opaque_types;
664
664
self
@@ -1213,8 +1213,7 @@ impl<'tcx> InferCtxt<'tcx> {
1213
1213
#[ inline( always) ]
1214
1214
pub fn can_define_opaque_ty ( & self , id : impl Into < DefId > ) -> bool {
1215
1215
let Some ( id) = id. into ( ) . as_local ( ) else { return false } ;
1216
- self . defining_opaque_types . in_signature . contains ( & id)
1217
- || self . defining_opaque_types . in_body . contains ( & id)
1216
+ self . defining_opaque_types . contains ( & id)
1218
1217
}
1219
1218
1220
1219
pub fn ty_to_string ( & self , t : Ty < ' tcx > ) -> String {
0 commit comments