Skip to content

Commit 1d344cf

Browse files
committed
typeck: Fix error reporting of wrong entry function signatures
Expected and actual type were switched, this was introduced by refactoring in 8eb12d9.
1 parent 77d2cd2 commit 1d344cf

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

src/librustc_typeck/lib.rs

+8-8
Original file line numberDiff line numberDiff line change
@@ -192,12 +192,12 @@ fn require_c_abi_if_variadic(tcx: TyCtxt,
192192

193193
fn require_same_types<'a, 'tcx>(ccx: &CrateCtxt<'a, 'tcx>,
194194
origin: TypeOrigin,
195-
t1: Ty<'tcx>,
196-
t2: Ty<'tcx>)
195+
expected: Ty<'tcx>,
196+
actual: Ty<'tcx>)
197197
-> bool {
198198
ccx.tcx.infer_ctxt(None, None, Reveal::NotSpecializable).enter(|infcx| {
199-
if let Err(err) = infcx.eq_types(false, origin.clone(), t1, t2) {
200-
infcx.report_mismatched_types(origin, t1, t2, err);
199+
if let Err(err) = infcx.eq_types(false, origin.clone(), expected, actual) {
200+
infcx.report_mismatched_types(origin, expected, actual, err);
201201
false
202202
} else {
203203
true
@@ -246,8 +246,8 @@ fn check_main_fn_ty(ccx: &CrateCtxt,
246246
require_same_types(
247247
ccx,
248248
TypeOrigin::MainFunctionType(main_span),
249-
main_t,
250-
se_ty);
249+
se_ty,
250+
main_t);
251251
}
252252
_ => {
253253
span_bug!(main_span,
@@ -302,8 +302,8 @@ fn check_start_fn_ty(ccx: &CrateCtxt,
302302
require_same_types(
303303
ccx,
304304
TypeOrigin::StartFunctionType(start_span),
305-
start_t,
306-
se_ty);
305+
se_ty,
306+
start_t);
307307
}
308308
_ => {
309309
span_bug!(start_span,

0 commit comments

Comments
 (0)