Skip to content

Commit 1513539

Browse files
committed
Improve error message for a failed assert or check
1 parent bf5840d commit 1513539

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/comp/middle/trans.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6157,11 +6157,11 @@ fn trans_expr_out(&@block_ctxt cx, &@ast::expr e, out_method output)
61576157
}
61586158

61596159
case (ast::expr_assert(?a, _)) {
6160-
ret trans_check_expr(cx, a);
6160+
ret trans_check_expr(cx, a, "Assertion");
61616161
}
61626162

61636163
case (ast::expr_check(?a, _)) {
6164-
ret trans_check_expr(cx, a);
6164+
ret trans_check_expr(cx, a, "Predicate");
61656165
}
61666166

61676167
case (ast::expr_break(?a)) {
@@ -6367,10 +6367,10 @@ fn trans_log(int lvl, &@block_ctxt cx, &@ast::expr e) -> result {
63676367
ret res(after_cx, C_nil());
63686368
}
63696369

6370-
fn trans_check_expr(&@block_ctxt cx, &@ast::expr e) -> result {
6370+
fn trans_check_expr(&@block_ctxt cx, &@ast::expr e, &str s) -> result {
63716371
auto cond_res = trans_expr(cx, e);
63726372

6373-
auto expr_str = expr_to_str(e);
6373+
auto expr_str = s + " " + expr_to_str(e) + " failed";
63746374
auto fail_cx = new_sub_block_ctxt(cx, "fail");
63756375
auto fail_res = trans_fail(fail_cx, some[common::span](e.span), expr_str);
63766376

0 commit comments

Comments
 (0)