Skip to content

Commit

Permalink
typeck: Fix error reporting of wrong entry function signatures
Browse files Browse the repository at this point in the history
Expected and actual type were switched, this was introduced by
refactoring in 8eb12d9.
  • Loading branch information
Florob committed Sep 5, 2016
1 parent 77d2cd2 commit 1d344cf
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/librustc_typeck/lib.rs
Expand Up @@ -192,12 +192,12 @@ fn require_c_abi_if_variadic(tcx: TyCtxt,

fn require_same_types<'a, 'tcx>(ccx: &CrateCtxt<'a, 'tcx>,
origin: TypeOrigin,
t1: Ty<'tcx>,
t2: Ty<'tcx>)
expected: Ty<'tcx>,
actual: Ty<'tcx>)
-> bool {
ccx.tcx.infer_ctxt(None, None, Reveal::NotSpecializable).enter(|infcx| {
if let Err(err) = infcx.eq_types(false, origin.clone(), t1, t2) {
infcx.report_mismatched_types(origin, t1, t2, err);
if let Err(err) = infcx.eq_types(false, origin.clone(), expected, actual) {
infcx.report_mismatched_types(origin, expected, actual, err);
false
} else {
true
Expand Down Expand Up @@ -246,8 +246,8 @@ fn check_main_fn_ty(ccx: &CrateCtxt,
require_same_types(
ccx,
TypeOrigin::MainFunctionType(main_span),
main_t,
se_ty);
se_ty,
main_t);
}
_ => {
span_bug!(main_span,
Expand Down Expand Up @@ -302,8 +302,8 @@ fn check_start_fn_ty(ccx: &CrateCtxt,
require_same_types(
ccx,
TypeOrigin::StartFunctionType(start_span),
start_t,
se_ty);
se_ty,
start_t);
}
_ => {
span_bug!(start_span,
Expand Down

0 comments on commit 1d344cf

Please sign in to comment.