@@ -8,8 +8,8 @@ use rustc_hir::def_id::{DefId, LocalDefId};
88use rustc_hir:: lang_items:: LangItem ;
99use rustc_hir:: ItemKind ;
1010use rustc_infer:: infer:: outlives:: env:: OutlivesEnvironment ;
11- use rustc_infer:: infer:: TyCtxtInferExt ;
1211use rustc_infer:: infer:: { self , RegionResolutionError } ;
12+ use rustc_infer:: infer:: { DefiningAnchor , TyCtxtInferExt } ;
1313use rustc_middle:: ty:: adjustment:: CoerceUnsizedInfo ;
1414use rustc_middle:: ty:: { self , suggest_constraining_type_params, Ty , TyCtxt , TypeVisitableExt } ;
1515use rustc_trait_selection:: traits:: error_reporting:: TypeErrCtxtExt ;
@@ -227,7 +227,8 @@ fn visit_implementation_of_dispatch_from_dyn(tcx: TyCtxt<'_>, impl_did: LocalDef
227227 use rustc_type_ir:: sty:: TyKind :: * ;
228228 match ( source. kind ( ) , target. kind ( ) ) {
229229 ( & Ref ( r_a, _, mutbl_a) , Ref ( r_b, _, mutbl_b) )
230- if infcx. at ( & cause, param_env) . eq ( r_a, * r_b) . is_ok ( ) && mutbl_a == * mutbl_b => { }
230+ if infcx. at ( & cause, param_env, DefiningAnchor :: Error ) . eq ( r_a, * r_b) . is_ok ( )
231+ && mutbl_a == * mutbl_b => { }
231232 ( & RawPtr ( tm_a) , & RawPtr ( tm_b) ) if tm_a. mutbl == tm_b. mutbl => ( ) ,
232233 ( & Adt ( def_a, substs_a) , & Adt ( def_b, substs_b) )
233234 if def_a. is_struct ( ) && def_b. is_struct ( ) =>
@@ -270,7 +271,9 @@ fn visit_implementation_of_dispatch_from_dyn(tcx: TyCtxt<'_>, impl_did: LocalDef
270271 }
271272 }
272273
273- if let Ok ( ok) = infcx. at ( & cause, param_env) . eq ( ty_a, ty_b) {
274+ if let Ok ( ok) =
275+ infcx. at ( & cause, param_env, DefiningAnchor :: Error ) . eq ( ty_a, ty_b)
276+ {
274277 if ok. obligations . is_empty ( ) {
275278 create_err (
276279 "the trait `DispatchFromDyn` may only be implemented \
@@ -497,7 +500,7 @@ pub fn coerce_unsized_info<'tcx>(tcx: TyCtxt<'tcx>, impl_did: DefId) -> CoerceUn
497500 // we may have to evaluate constraint
498501 // expressions in the course of execution.)
499502 // See e.g., #41936.
500- if let Ok ( ok) = infcx. at ( & cause, param_env) . eq ( a, b) {
503+ if let Ok ( ok) = infcx. at ( & cause, param_env, DefiningAnchor :: Error ) . eq ( a, b) {
501504 if ok. obligations . is_empty ( ) {
502505 return None ;
503506 }
0 commit comments