@@ -144,7 +144,7 @@ impl<'tcx> InferCtxt<'tcx> {
144144 // ```
145145 self . opaque_type_origin ( def_id) ?
146146 }
147- DefiningAnchor :: Bubble => self . opaque_type_origin_unchecked ( def_id) ,
147+ DefiningAnchor :: Ignore => self . opaque_type_origin_unchecked ( def_id) ,
148148 DefiningAnchor :: Error => return None ,
149149 } ;
150150 if let ty:: Alias ( ty:: Opaque , ty:: AliasTy { def_id : b_def_id, .. } ) = * b. kind ( ) {
@@ -374,7 +374,7 @@ impl<'tcx> InferCtxt<'tcx> {
374374 pub fn opaque_type_origin ( & self , def_id : LocalDefId ) -> Option < OpaqueTyOrigin > {
375375 let opaque_hir_id = self . tcx . hir ( ) . local_def_id_to_hir_id ( def_id) ;
376376 let parent_def_id = match self . defining_use_anchor {
377- DefiningAnchor :: Bubble | DefiningAnchor :: Error => return None ,
377+ DefiningAnchor :: Ignore | DefiningAnchor :: Error => return None ,
378378 DefiningAnchor :: Bind ( bind) => bind,
379379 } ;
380380
@@ -539,14 +539,16 @@ impl<'tcx> InferCtxt<'tcx> {
539539 let span = cause. span ;
540540
541541 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+ }
550552 }
551553
552554 let item_bounds = tcx. bound_explicit_item_bounds ( def_id. to_def_id ( ) ) ;
0 commit comments