@@ -142,7 +142,6 @@ impl<'a, 'tcx> ConfirmContext<'a, 'tcx> {
142
142
143
143
let ( method_sig, method_predicates) =
144
144
self . normalize ( self . span , ( method_sig, method_predicates) ) ;
145
- let method_sig = ty:: Binder :: dummy ( method_sig) ;
146
145
147
146
// Make sure nobody calls `drop()` explicitly.
148
147
self . check_for_illegal_method_calls ( pick) ;
@@ -154,20 +153,11 @@ impl<'a, 'tcx> ConfirmContext<'a, 'tcx> {
154
153
// We won't add these if we encountered an illegal sized bound, so that we can use
155
154
// a custom error in that case.
156
155
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 ) ;
163
157
}
164
158
165
159
// 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 } ;
171
161
ConfirmResult { callee, illegal_sized_bound }
172
162
}
173
163
@@ -601,14 +591,14 @@ impl<'a, 'tcx> ConfirmContext<'a, 'tcx> {
601
591
602
592
fn add_obligations (
603
593
& mut self ,
604
- fty : Ty < ' tcx > ,
594
+ sig : ty :: FnSig < ' tcx > ,
605
595
all_args : GenericArgsRef < ' tcx > ,
606
596
method_predicates : ty:: InstantiatedPredicates < ' tcx > ,
607
597
def_id : DefId ,
608
598
) {
609
599
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
612
602
) ;
613
603
614
604
// FIXME: could replace with the following, but we already calculated `method_predicates`,
@@ -637,7 +627,13 @@ impl<'a, 'tcx> ConfirmContext<'a, 'tcx> {
637
627
// the function type must also be well-formed (this is not
638
628
// implied by the args being well-formed because of inherent
639
629
// 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
+ }
641
637
}
642
638
643
639
///////////////////////////////////////////////////////////////////////////
0 commit comments