@@ -10,7 +10,7 @@ use rustc_middle::mir::visit::{MutatingUseContext, NonMutatingUseContext, PlaceC
1010use rustc_middle:: mir:: * ;
1111use rustc_middle:: ty:: subst:: { GenericArgKind , InternalSubsts } ;
1212use rustc_middle:: ty:: { self , adjustment:: PointerCast , Instance , InstanceDef , Ty , TyCtxt } ;
13- use rustc_middle:: ty:: { Binder , TraitRef , TypeVisitableExt } ;
13+ use rustc_middle:: ty:: { TraitRef , TypeVisitableExt } ;
1414use rustc_mir_dataflow:: { self , Analysis } ;
1515use rustc_span:: { sym, Span , Symbol } ;
1616use rustc_trait_selection:: traits:: error_reporting:: TypeErrCtxtExt as _;
@@ -755,10 +755,9 @@ impl<'tcx> Visitor<'tcx> for Checker<'_, 'tcx> {
755755 }
756756
757757 let trait_ref = TraitRef :: from_method ( tcx, trait_id, substs) ;
758- let poly_trait_pred =
759- Binder :: dummy ( trait_ref) . with_constness ( ty:: BoundConstness :: ConstIfConst ) ;
758+ let trait_ref = trait_ref. with_constness ( ty:: BoundConstness :: ConstIfConst ) ;
760759 let obligation =
761- Obligation :: new ( tcx, ObligationCause :: dummy ( ) , param_env, poly_trait_pred ) ;
760+ Obligation :: new ( tcx, ObligationCause :: dummy ( ) , param_env, trait_ref ) ;
762761
763762 let implsrc = {
764763 let infcx = tcx. infer_ctxt ( ) . build ( ) ;
@@ -776,11 +775,11 @@ impl<'tcx> Visitor<'tcx> for Checker<'_, 'tcx> {
776775 }
777776 // Closure: Fn{Once|Mut}
778777 Ok ( Some ( ImplSource :: Builtin ( _) ) )
779- if poly_trait_pred . self_ty ( ) . skip_binder ( ) . is_closure ( )
778+ if trait_ref . self_ty ( ) . is_closure ( )
780779 && tcx. fn_trait_kind_from_def_id ( trait_id) . is_some ( ) =>
781780 {
782781 let ty:: Closure ( closure_def_id, substs) =
783- * poly_trait_pred . self_ty ( ) . no_bound_vars ( ) . unwrap ( ) . kind ( )
782+ * trait_ref . self_ty ( ) . kind ( )
784783 else {
785784 unreachable ! ( )
786785 } ;
@@ -840,7 +839,7 @@ impl<'tcx> Visitor<'tcx> for Checker<'_, 'tcx> {
840839 tcx,
841840 ObligationCause :: dummy_with_span ( * fn_span) ,
842841 param_env,
843- poly_trait_pred ,
842+ trait_ref ,
844843 ) ;
845844
846845 // improve diagnostics by showing what failed. Our requirements are stricter this time
0 commit comments