From 0cddcac0169a33163dc434eb325d48d7f193efc4 Mon Sep 17 00:00:00 2001 From: Brian Anderson Date: Wed, 10 Aug 2011 21:49:22 -0700 Subject: [PATCH] rustc: Use spans in some main typeck errors --- src/comp/middle/typeck.rs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/comp/middle/typeck.rs b/src/comp/middle/typeck.rs index f2ef584214b7..2fa8b5c2506a 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)); } } }