diff --git a/src/comp/middle/typeck.rs b/src/comp/middle/typeck.rs index f2ef584214b..2fa8b5c2506 100644 --- a/src/comp/middle/typeck.rs +++ b/src/comp/middle/typeck.rs @@ -2681,13 +2681,15 @@ fn check_main_fn_ty(tcx: &ty::ctxt, main_id: &ast::node_id) { ok &= num_args == 0u || num_args == 1u && arg_is_argv_ty(tcx, args.(0)); if !ok { - tcx.sess.err("wrong type in main function: found " + - ty_to_str(tcx, main_t)); + let span = ast_map::node_span(tcx.items.get(main_id)); + tcx.sess.span_err(span, "wrong type in main function: found " + + ty_to_str(tcx, main_t)); } } _ { - tcx.sess.bug("main has a non-function type: found" + - ty_to_str(tcx, main_t)); + let span = ast_map::node_span(tcx.items.get(main_id)); + tcx.sess.span_bug(span, "main has a non-function type: found" + + ty_to_str(tcx, main_t)); } } }