@@ -10,8 +10,8 @@ use rustc_hir::def_id::{DefId, LocalDefId};
1010use  rustc_hir:: lang_items:: LangItem ; 
1111use  rustc_hir:: ItemKind ; 
1212use  rustc_infer:: infer:: outlives:: env:: OutlivesEnvironment ; 
13+ use  rustc_infer:: infer:: TyCtxtInferExt ; 
1314use  rustc_infer:: infer:: { self ,  RegionResolutionError } ; 
14- use  rustc_infer:: infer:: { DefineOpaqueTypes ,  TyCtxtInferExt } ; 
1515use  rustc_infer:: traits:: Obligation ; 
1616use  rustc_middle:: ty:: adjustment:: CoerceUnsizedInfo ; 
1717use  rustc_middle:: ty:: { self ,  suggest_constraining_type_params,  Ty ,  TyCtxt ,  TypeVisitableExt } ; 
@@ -189,10 +189,7 @@ fn visit_implementation_of_dispatch_from_dyn(checker: &Checker<'_>) -> Result<()
189189    // even if they do not carry that attribute. 
190190    use  rustc_type_ir:: TyKind :: * ; 
191191    match  ( source. kind ( ) ,  target. kind ( ) )  { 
192-         ( & Ref ( r_a,  _,  mutbl_a) ,  Ref ( r_b,  _,  mutbl_b) ) 
193-             if  infcx. at ( & cause,  param_env) . eq ( DefineOpaqueTypes :: No ,  r_a,  * r_b) . is_ok ( ) 
194-                 && mutbl_a == * mutbl_b =>
195-         { 
192+         ( & Ref ( r_a,  _,  mutbl_a) ,  Ref ( r_b,  _,  mutbl_b) )  if  r_a == * r_b && mutbl_a == * mutbl_b => { 
196193            Ok ( ( ) ) 
197194        } 
198195        ( & RawPtr ( _,  a_mutbl) ,  & RawPtr ( _,  b_mutbl) )  if  a_mutbl == b_mutbl => Ok ( ( ) ) , 
@@ -230,18 +227,14 @@ fn visit_implementation_of_dispatch_from_dyn(checker: &Checker<'_>) -> Result<()
230227                        } 
231228                    } 
232229
233-                     if  let  Ok ( ok)  =
234-                         infcx. at ( & cause,  param_env) . eq ( DefineOpaqueTypes :: No ,  ty_a,  ty_b) 
235-                     { 
236-                         if  ok. obligations . is_empty ( )  { 
237-                             res = Err ( tcx. dcx ( ) . emit_err ( errors:: DispatchFromDynZST  { 
238-                                 span, 
239-                                 name :  field. name , 
240-                                 ty :  ty_a, 
241-                             } ) ) ; 
230+                     if  ty_a == ty_b { 
231+                         res = Err ( tcx. dcx ( ) . emit_err ( errors:: DispatchFromDynZST  { 
232+                             span, 
233+                             name :  field. name , 
234+                             ty :  ty_a, 
235+                         } ) ) ; 
242236
243-                             return  false ; 
244-                         } 
237+                         return  false ; 
245238                    } 
246239
247240                    return  true ; 
@@ -433,14 +426,12 @@ pub fn coerce_unsized_info<'tcx>(
433426                    // something more accepting, but we use 
434427                    // equality because we want to be able to 
435428                    // perform this check without computing 
436-                     // variance where possible. (This is because  
437-                     // we may have to evaluate constraint 
429+                     // variance or constraining opaque types' hidden types.  
430+                     // (This is because  we may have to evaluate constraint 
438431                    // expressions in the course of execution.) 
439432                    // See e.g., #41936. 
440-                     if  let  Ok ( ok)  = infcx. at ( & cause,  param_env) . eq ( DefineOpaqueTypes :: No ,  a,  b)  { 
441-                         if  ok. obligations . is_empty ( )  { 
442-                             return  None ; 
443-                         } 
433+                     if  a == b { 
434+                         return  None ; 
444435                    } 
445436
446437                    // Collect up all fields that were significantly changed 
0 commit comments