@@ -142,7 +142,6 @@ impl<'a, 'tcx> ConfirmContext<'a, 'tcx> {
142142
143143 let ( method_sig, method_predicates) =
144144 self . normalize ( self . span , ( method_sig, method_predicates) ) ;
145- let method_sig = ty:: Binder :: dummy ( method_sig) ;
146145
147146 // Make sure nobody calls `drop()` explicitly.
148147 self . check_for_illegal_method_calls ( pick) ;
@@ -154,20 +153,11 @@ impl<'a, 'tcx> ConfirmContext<'a, 'tcx> {
154153 // We won't add these if we encountered an illegal sized bound, so that we can use
155154 // a custom error in that case.
156155 if illegal_sized_bound. is_none ( ) {
157- self . add_obligations (
158- Ty :: new_fn_ptr ( self . tcx , method_sig) ,
159- all_args,
160- method_predicates,
161- pick. item . def_id ,
162- ) ;
156+ self . add_obligations ( method_sig, all_args, method_predicates, pick. item . def_id ) ;
163157 }
164158
165159 // Create the final `MethodCallee`.
166- let callee = MethodCallee {
167- def_id : pick. item . def_id ,
168- args : all_args,
169- sig : method_sig. skip_binder ( ) ,
170- } ;
160+ let callee = MethodCallee { def_id : pick. item . def_id , args : all_args, sig : method_sig } ;
171161 ConfirmResult { callee, illegal_sized_bound }
172162 }
173163
@@ -601,14 +591,14 @@ impl<'a, 'tcx> ConfirmContext<'a, 'tcx> {
601591
602592 fn add_obligations (
603593 & mut self ,
604- fty : Ty < ' tcx > ,
594+ sig : ty :: FnSig < ' tcx > ,
605595 all_args : GenericArgsRef < ' tcx > ,
606596 method_predicates : ty:: InstantiatedPredicates < ' tcx > ,
607597 def_id : DefId ,
608598 ) {
609599 debug ! (
610- "add_obligations: fty ={:?} all_args={:?} method_predicates={:?} def_id={:?}" ,
611- fty , all_args, method_predicates, def_id
600+ "add_obligations: sig ={:?} all_args={:?} method_predicates={:?} def_id={:?}" ,
601+ sig , all_args, method_predicates, def_id
612602 ) ;
613603
614604 // FIXME: could replace with the following, but we already calculated `method_predicates`,
@@ -637,7 +627,13 @@ impl<'a, 'tcx> ConfirmContext<'a, 'tcx> {
637627 // the function type must also be well-formed (this is not
638628 // implied by the args being well-formed because of inherent
639629 // impls and late-bound regions - see issue #28609).
640- self . register_wf_obligation ( fty. into ( ) , self . span , ObligationCauseCode :: WellFormed ( None ) ) ;
630+ for ty in sig. inputs_and_output {
631+ self . register_wf_obligation (
632+ ty. into ( ) ,
633+ self . span ,
634+ ObligationCauseCode :: WellFormed ( None ) ,
635+ ) ;
636+ }
641637 }
642638
643639 ///////////////////////////////////////////////////////////////////////////
0 commit comments