@@ -243,7 +243,7 @@ pub struct InferCtxt<'tcx> {
243243 pub tcx : TyCtxt < ' tcx > ,
244244
245245 /// 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 > ,
247247
248248 /// Whether this inference context should care about region obligations in
249249 /// the root universe. Most notably, this is used during hir typeck as region
@@ -370,7 +370,7 @@ impl<'tcx> ty::InferCtxtLike for InferCtxt<'tcx> {
370370 self . inner . borrow_mut ( ) . unwrap_region_constraints ( ) . opportunistic_resolve_var ( self . tcx , vid)
371371 }
372372
373- fn defining_opaque_types ( & self ) -> ty:: OpaqueTypes < ' tcx > {
373+ fn defining_opaque_types ( & self ) -> & ' tcx ty:: List < LocalDefId > {
374374 self . defining_opaque_types
375375 }
376376
@@ -620,7 +620,7 @@ impl fmt::Display for FixupError {
620620/// Used to configure inference contexts before their creation.
621621pub struct InferCtxtBuilder < ' tcx > {
622622 tcx : TyCtxt < ' tcx > ,
623- defining_opaque_types : ty:: OpaqueTypes < ' tcx > ,
623+ defining_opaque_types : & ' tcx ty:: List < LocalDefId > ,
624624 considering_regions : bool ,
625625 skip_leak_check : bool ,
626626 /// Whether we are in coherence mode.
@@ -635,7 +635,7 @@ impl<'tcx> TyCtxt<'tcx> {
635635 fn infer_ctxt ( self ) -> InferCtxtBuilder < ' tcx > {
636636 InferCtxtBuilder {
637637 tcx : self ,
638- defining_opaque_types : Default :: default ( ) ,
638+ defining_opaque_types : ty :: List :: empty ( ) ,
639639 considering_regions : true ,
640640 skip_leak_check : false ,
641641 intercrate : false ,
@@ -651,14 +651,14 @@ impl<'tcx> InferCtxtBuilder<'tcx> {
651651 /// It is only meant to be called in two places, for typeck
652652 /// (via `Inherited::build`) and for the inference context used
653653 /// 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
657657 }
658658
659659 pub fn with_defining_opaque_types (
660660 mut self ,
661- defining_opaque_types : ty:: OpaqueTypes < ' tcx > ,
661+ defining_opaque_types : & ' tcx ty:: List < LocalDefId > ,
662662 ) -> Self {
663663 self . defining_opaque_types = defining_opaque_types;
664664 self
@@ -1213,8 +1213,7 @@ impl<'tcx> InferCtxt<'tcx> {
12131213 #[ inline( always) ]
12141214 pub fn can_define_opaque_ty ( & self , id : impl Into < DefId > ) -> bool {
12151215 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)
12181217 }
12191218
12201219 pub fn ty_to_string ( & self , t : Ty < ' tcx > ) -> String {
0 commit comments