rustc: Use spans in some main typeck errors

This commit is contained in:
Brian Anderson 2011-08-10 21:49:22 -07:00
parent 612fe3d2d6
commit 0cddcac016

View File

@ -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));
}
}
}