diff options
| author | Brian Anderson <banderson@mozilla.com> | 2011-08-10 21:49:22 -0700 |
|---|---|---|
| committer | Brian Anderson <banderson@mozilla.com> | 2011-08-11 10:09:02 -0700 |
| commit | 0cddcac0169a33163dc434eb325d48d7f193efc4 (patch) | |
| tree | 225ecf85192babfc98adcbb046a057aaa3e0f219 /src/comp | |
| parent | 612fe3d2d6fa0dcb3d92a0d83ec7f2418dd8c7ce (diff) | |
| download | rust-0cddcac0169a33163dc434eb325d48d7f193efc4.tar.gz rust-0cddcac0169a33163dc434eb325d48d7f193efc4.zip | |
rustc: Use spans in some main typeck errors
Diffstat (limited to 'src/comp')
| -rw-r--r-- | src/comp/middle/typeck.rs | 10 |
1 files changed, 6 insertions, 4 deletions
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)); } } } |
