@@ -135,30 +135,23 @@ impl<'tcx> TailCallCkVisitor<'_, 'tcx> {
135
135
self . report_abi_mismatch ( expr. span , caller_sig. abi , callee_sig. abi ) ;
136
136
}
137
137
138
+ // FIXME(explicit_tail_calls): this currently fails for cases where opaques are used.
139
+ // e.g.
140
+ // ```
141
+ // fn a() -> impl Sized { become b() } // ICE
142
+ // fn b() -> u8 { 0 }
143
+ // ```
144
+ // we should think what is the expected behavior here.
145
+ // (we should probably just accept this by revealing opaques?)
138
146
if caller_sig. inputs_and_output != callee_sig. inputs_and_output {
139
- if caller_sig. inputs ( ) != callee_sig. inputs ( ) {
140
- self . report_arguments_mismatch (
141
- expr. span ,
142
- self . tcx . liberate_late_bound_regions (
143
- CRATE_DEF_ID . to_def_id ( ) ,
144
- self . caller_ty . fn_sig ( self . tcx ) ,
145
- ) ,
146
- self . tcx
147
- . liberate_late_bound_regions ( CRATE_DEF_ID . to_def_id ( ) , ty. fn_sig ( self . tcx ) ) ,
148
- ) ;
149
- }
150
-
151
- // FIXME(explicit_tail_calls): this currently fails for cases where opaques are used.
152
- // e.g.
153
- // ```
154
- // fn a() -> impl Sized { become b() } // ICE
155
- // fn b() -> u8 { 0 }
156
- // ```
157
- // we should think what is the expected behavior here.
158
- // (we should probably just accept this by revealing opaques?)
159
- if caller_sig. output ( ) != callee_sig. output ( ) {
160
- span_bug ! ( expr. span, "hir typeck should have checked the return type already" ) ;
161
- }
147
+ self . report_signature_mismatch (
148
+ expr. span ,
149
+ self . tcx . liberate_late_bound_regions (
150
+ CRATE_DEF_ID . to_def_id ( ) ,
151
+ self . caller_ty . fn_sig ( self . tcx ) ,
152
+ ) ,
153
+ self . tcx . liberate_late_bound_regions ( CRATE_DEF_ID . to_def_id ( ) , ty. fn_sig ( self . tcx ) ) ,
154
+ ) ;
162
155
}
163
156
164
157
{
@@ -365,7 +358,7 @@ impl<'tcx> TailCallCkVisitor<'_, 'tcx> {
365
358
self . found_errors = Err ( err) ;
366
359
}
367
360
368
- fn report_arguments_mismatch (
361
+ fn report_signature_mismatch (
369
362
& mut self ,
370
363
sp : Span ,
371
364
caller_sig : ty:: FnSig < ' _ > ,
0 commit comments