@@ -10,7 +10,7 @@ use rustc_middle::mir::visit::{MutatingUseContext, NonMutatingUseContext, PlaceC
10
10
use rustc_middle:: mir:: * ;
11
11
use rustc_middle:: ty:: subst:: { GenericArgKind , InternalSubsts } ;
12
12
use 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 } ;
14
14
use rustc_mir_dataflow:: { self , Analysis } ;
15
15
use rustc_span:: { sym, Span , Symbol } ;
16
16
use rustc_trait_selection:: traits:: error_reporting:: TypeErrCtxtExt as _;
@@ -755,10 +755,9 @@ impl<'tcx> Visitor<'tcx> for Checker<'_, 'tcx> {
755
755
}
756
756
757
757
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 ) ;
760
759
let obligation =
761
- Obligation :: new ( tcx, ObligationCause :: dummy ( ) , param_env, poly_trait_pred ) ;
760
+ Obligation :: new ( tcx, ObligationCause :: dummy ( ) , param_env, trait_ref ) ;
762
761
763
762
let implsrc = {
764
763
let infcx = tcx. infer_ctxt ( ) . build ( ) ;
@@ -776,11 +775,11 @@ impl<'tcx> Visitor<'tcx> for Checker<'_, 'tcx> {
776
775
}
777
776
// Closure: Fn{Once|Mut}
778
777
Ok ( Some ( ImplSource :: Builtin ( _) ) )
779
- if poly_trait_pred . self_ty ( ) . skip_binder ( ) . is_closure ( )
778
+ if trait_ref . self_ty ( ) . is_closure ( )
780
779
&& tcx. fn_trait_kind_from_def_id ( trait_id) . is_some ( ) =>
781
780
{
782
781
let ty:: Closure ( closure_def_id, substs) =
783
- * poly_trait_pred . self_ty ( ) . no_bound_vars ( ) . unwrap ( ) . kind ( )
782
+ * trait_ref . self_ty ( ) . kind ( )
784
783
else {
785
784
unreachable ! ( )
786
785
} ;
@@ -840,7 +839,7 @@ impl<'tcx> Visitor<'tcx> for Checker<'_, 'tcx> {
840
839
tcx,
841
840
ObligationCause :: dummy_with_span ( * fn_span) ,
842
841
param_env,
843
- poly_trait_pred ,
842
+ trait_ref ,
844
843
) ;
845
844
846
845
// improve diagnostics by showing what failed. Our requirements are stricter this time
0 commit comments