@@ -242,7 +242,8 @@ pub struct InferCtxt<'tcx> {
242242 /// short lived InferCtxt within queries. The opaque type obligations are forwarded
243243 /// to the outside until the end up in an `InferCtxt` for typeck or borrowck.
244244 ///
245- /// Its default value is `DefiningAnchor::Error`, this way it is easier to catch errors that
245+ /// Its default value is `DefiningAnchor::Bind(&[])`, which means no opaque types may be defined.
246+ /// This way it is easier to catch errors that
246247 /// might come up during inference or typeck.
247248 pub defining_use_anchor : DefiningAnchor < ' tcx > ,
248249
@@ -620,7 +621,7 @@ impl<'tcx> TyCtxt<'tcx> {
620621 fn infer_ctxt ( self ) -> InferCtxtBuilder < ' tcx > {
621622 InferCtxtBuilder {
622623 tcx : self ,
623- defining_use_anchor : DefiningAnchor :: Error ,
624+ defining_use_anchor : DefiningAnchor :: Bind ( ty :: List :: empty ( ) ) ,
624625 considering_regions : true ,
625626 skip_leak_check : false ,
626627 intercrate : false ,
@@ -1208,13 +1209,11 @@ impl<'tcx> InferCtxt<'tcx> {
12081209
12091210 #[ instrument( level = "debug" , skip( self ) , ret) ]
12101211 pub fn take_opaque_types ( & self ) -> opaque_types:: OpaqueTypeMap < ' tcx > {
1211- debug_assert_ne ! ( self . defining_use_anchor, DefiningAnchor :: Error ) ;
12121212 std:: mem:: take ( & mut self . inner . borrow_mut ( ) . opaque_type_storage . opaque_types )
12131213 }
12141214
12151215 #[ instrument( level = "debug" , skip( self ) , ret) ]
12161216 pub fn clone_opaque_types ( & self ) -> opaque_types:: OpaqueTypeMap < ' tcx > {
1217- debug_assert_ne ! ( self . defining_use_anchor, DefiningAnchor :: Error ) ;
12181217 self . inner . borrow ( ) . opaque_type_storage . opaque_types . clone ( )
12191218 }
12201219
0 commit comments