@@ -250,7 +250,8 @@ pub struct InferCtxt<'tcx> {
250
250
/// short lived InferCtxt within queries. The opaque type obligations are forwarded
251
251
/// to the outside until the end up in an `InferCtxt` for typeck or borrowck.
252
252
///
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
254
255
/// might come up during inference or typeck.
255
256
pub defining_use_anchor : DefiningAnchor < ' tcx > ,
256
257
@@ -628,7 +629,7 @@ impl<'tcx> TyCtxt<'tcx> {
628
629
fn infer_ctxt ( self ) -> InferCtxtBuilder < ' tcx > {
629
630
InferCtxtBuilder {
630
631
tcx : self ,
631
- defining_use_anchor : DefiningAnchor :: Error ,
632
+ defining_use_anchor : DefiningAnchor :: Bind ( ty :: List :: empty ( ) ) ,
632
633
considering_regions : true ,
633
634
skip_leak_check : false ,
634
635
intercrate : false ,
@@ -1307,13 +1308,11 @@ impl<'tcx> InferCtxt<'tcx> {
1307
1308
1308
1309
#[ instrument( level = "debug" , skip( self ) , ret) ]
1309
1310
pub fn take_opaque_types ( & self ) -> opaque_types:: OpaqueTypeMap < ' tcx > {
1310
- debug_assert_ne ! ( self . defining_use_anchor, DefiningAnchor :: Error ) ;
1311
1311
std:: mem:: take ( & mut self . inner . borrow_mut ( ) . opaque_type_storage . opaque_types )
1312
1312
}
1313
1313
1314
1314
#[ instrument( level = "debug" , skip( self ) , ret) ]
1315
1315
pub fn clone_opaque_types ( & self ) -> opaque_types:: OpaqueTypeMap < ' tcx > {
1316
- debug_assert_ne ! ( self . defining_use_anchor, DefiningAnchor :: Error ) ;
1317
1316
self . inner . borrow ( ) . opaque_type_storage . opaque_types . clone ( )
1318
1317
}
1319
1318
0 commit comments