@@ -144,7 +144,7 @@ impl<'tcx> InferCtxt<'tcx> {
144
144
// ```
145
145
self . opaque_type_origin ( def_id) ?
146
146
}
147
- DefiningAnchor :: Bubble => self . opaque_type_origin_unchecked ( def_id) ,
147
+ DefiningAnchor :: Ignore => self . opaque_type_origin_unchecked ( def_id) ,
148
148
DefiningAnchor :: Error => return None ,
149
149
} ;
150
150
if let ty:: Alias ( ty:: Opaque , ty:: AliasTy { def_id : b_def_id, .. } ) = * b. kind ( ) {
@@ -374,7 +374,7 @@ impl<'tcx> InferCtxt<'tcx> {
374
374
pub fn opaque_type_origin ( & self , def_id : LocalDefId ) -> Option < OpaqueTyOrigin > {
375
375
let opaque_hir_id = self . tcx . hir ( ) . local_def_id_to_hir_id ( def_id) ;
376
376
let parent_def_id = match self . defining_use_anchor {
377
- DefiningAnchor :: Bubble | DefiningAnchor :: Error => return None ,
377
+ DefiningAnchor :: Ignore | DefiningAnchor :: Error => return None ,
378
378
DefiningAnchor :: Bind ( bind) => bind,
379
379
} ;
380
380
@@ -539,14 +539,16 @@ impl<'tcx> InferCtxt<'tcx> {
539
539
let span = cause. span ;
540
540
541
541
let mut obligations = vec ! [ ] ;
542
- let prev = self . inner . borrow_mut ( ) . opaque_types ( ) . register (
543
- OpaqueTypeKey { def_id, substs } ,
544
- OpaqueHiddenType { ty : hidden_ty, span } ,
545
- origin,
546
- ) ;
547
- if let Some ( prev) = prev {
548
- obligations =
549
- self . at ( & cause, param_env) . eq_exp ( a_is_expected, prev, hidden_ty) ?. obligations ;
542
+ if !matches ! ( self . defining_use_anchor, DefiningAnchor :: Ignore ) {
543
+ let prev = self . inner . borrow_mut ( ) . opaque_types ( ) . register (
544
+ OpaqueTypeKey { def_id, substs } ,
545
+ OpaqueHiddenType { ty : hidden_ty, span } ,
546
+ origin,
547
+ ) ;
548
+ if let Some ( prev) = prev {
549
+ obligations =
550
+ self . at ( & cause, param_env) . eq_exp ( a_is_expected, prev, hidden_ty) ?. obligations ;
551
+ }
550
552
}
551
553
552
554
let item_bounds = tcx. bound_explicit_item_bounds ( def_id. to_def_id ( ) ) ;
0 commit comments