@@ -250,7 +250,8 @@ pub struct InferCtxt<'tcx> {
250250 /// short lived InferCtxt within queries. The opaque type obligations are forwarded
251251 /// to the outside until the end up in an `InferCtxt` for typeck or borrowck.
252252 ///
253- /// Its default value is `DefiningAnchor::Error`, this way it is easier to catch errors that
253+ /// Its default value is `DefiningAnchor::Bind(&[])`, which means no opaque types may be defined.
254+ /// This way it is easier to catch errors that
254255 /// might come up during inference or typeck.
255256 pub defining_use_anchor : DefiningAnchor < ' tcx > ,
256257
@@ -628,7 +629,7 @@ impl<'tcx> TyCtxt<'tcx> {
628629 fn infer_ctxt ( self ) -> InferCtxtBuilder < ' tcx > {
629630 InferCtxtBuilder {
630631 tcx : self ,
631- defining_use_anchor : DefiningAnchor :: Error ,
632+ defining_use_anchor : DefiningAnchor :: Bind ( ty :: List :: empty ( ) ) ,
632633 considering_regions : true ,
633634 skip_leak_check : false ,
634635 intercrate : false ,
@@ -1307,13 +1308,11 @@ impl<'tcx> InferCtxt<'tcx> {
13071308
13081309 #[ instrument( level = "debug" , skip( self ) , ret) ]
13091310 pub fn take_opaque_types ( & self ) -> opaque_types:: OpaqueTypeMap < ' tcx > {
1310- debug_assert_ne ! ( self . defining_use_anchor, DefiningAnchor :: Error ) ;
13111311 std:: mem:: take ( & mut self . inner . borrow_mut ( ) . opaque_type_storage . opaque_types )
13121312 }
13131313
13141314 #[ instrument( level = "debug" , skip( self ) , ret) ]
13151315 pub fn clone_opaque_types ( & self ) -> opaque_types:: OpaqueTypeMap < ' tcx > {
1316- debug_assert_ne ! ( self . defining_use_anchor, DefiningAnchor :: Error ) ;
13171316 self . inner . borrow ( ) . opaque_type_storage . opaque_types . clone ( )
13181317 }
13191318
0 commit comments