Skip to content

Commit 0cddcac

Browse files
committed
rustc: Use spans in some main typeck errors
1 parent 612fe3d commit 0cddcac

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/comp/middle/typeck.rs

+6-4
Original file line numberDiff line numberDiff line change
@@ -2681,13 +2681,15 @@ fn check_main_fn_ty(tcx: &ty::ctxt, main_id: &ast::node_id) {
26812681
ok &=
26822682
num_args == 0u || num_args == 1u && arg_is_argv_ty(tcx, args.(0));
26832683
if !ok {
2684-
tcx.sess.err("wrong type in main function: found " +
2685-
ty_to_str(tcx, main_t));
2684+
let span = ast_map::node_span(tcx.items.get(main_id));
2685+
tcx.sess.span_err(span, "wrong type in main function: found " +
2686+
ty_to_str(tcx, main_t));
26862687
}
26872688
}
26882689
_ {
2689-
tcx.sess.bug("main has a non-function type: found" +
2690-
ty_to_str(tcx, main_t));
2690+
let span = ast_map::node_span(tcx.items.get(main_id));
2691+
tcx.sess.span_bug(span, "main has a non-function type: found" +
2692+
ty_to_str(tcx, main_t));
26912693
}
26922694
}
26932695
}

0 commit comments

Comments
 (0)