Skip to content

Commit 35a1fef

Browse files
authored
Auto merge of #36131 - Florob:entry_typeck, r=eddyb
typeck: Fix error reporting of wrong entry function signatures Expected and actual type were switched, this was introduced by refactoring in 8eb12d9.
2 parents 3fba503 + 1d344cf commit 35a1fef

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
@@ -194,12 +194,12 @@ fn require_c_abi_if_variadic(tcx: TyCtxt,
194194

195195
fn require_same_types<'a, 'tcx>(ccx: &CrateCtxt<'a, 'tcx>,
196196
origin: TypeOrigin,
197-
t1: Ty<'tcx>,
198-
t2: Ty<'tcx>)
197+
expected: Ty<'tcx>,
198+
actual: Ty<'tcx>)
199199
-> bool {
200200
ccx.tcx.infer_ctxt(None, None, Reveal::NotSpecializable).enter(|infcx| {
201-
if let Err(err) = infcx.eq_types(false, origin.clone(), t1, t2) {
202-
infcx.report_mismatched_types(origin, t1, t2, err);
201+
if let Err(err) = infcx.eq_types(false, origin.clone(), expected, actual) {
202+
infcx.report_mismatched_types(origin, expected, actual, err);
203203
false
204204
} else {
205205
true
@@ -248,8 +248,8 @@ fn check_main_fn_ty(ccx: &CrateCtxt,
248248
require_same_types(
249249
ccx,
250250
TypeOrigin::MainFunctionType(main_span),
251-
main_t,
252-
se_ty);
251+
se_ty,
252+
main_t);
253253
}
254254
_ => {
255255
span_bug!(main_span,
@@ -303,8 +303,8 @@ fn check_start_fn_ty(ccx: &CrateCtxt,
303303
require_same_types(
304304
ccx,
305305
TypeOrigin::StartFunctionType(start_span),
306-
start_t,
307-
se_ty);
306+
se_ty,
307+
start_t);
308308
}
309309
_ => {
310310
span_bug!(start_span,

0 commit comments

Comments
 (0)