Skip to content

Commit 0c3b199

Browse files
committed
---
yaml --- r: 3567 b: refs/heads/master c: fb10829 h: refs/heads/master i: 3565: 76d7b9e 3563: d4c6272 3559: e4f1df7 3551: 539e528 v: v3
1 parent c138195 commit 0c3b199

File tree

2 files changed

+14
-13
lines changed

2 files changed

+14
-13
lines changed

[refs]

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
---
2-
refs/heads/master: b1423be1d6bbb077bc97928e36a6019e2a74c029
2+
refs/heads/master: fb10829aefbb7493c41ee1a5ec4c958692b33c28

trunk/src/comp/middle/alias.rs

+13-12
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ fn check_crate(@ty::ctxt tcx, &@ast::crate crate) {
5151
visit_expr=bind visit_expr(cx, _, _, _)
5252
with *visit::default_visitor[scope]());
5353
visit::visit_crate(*crate, [], visit::vtor(v));
54+
tcx.sess.abort_if_errors();
5455
}
5556

5657
fn visit_fn(@ctx cx, &ast::_fn f, &vec[ast::ty_param] tp, &span sp,
@@ -93,7 +94,7 @@ fn visit_expr(@ctx cx, &@ast::expr ex, &scope sc, &vt[scope] v) {
9394
case (some(?ex)) {
9495
auto root = expr_root(*cx, ex, false);
9596
if (mut_field(root.ds)) {
96-
cx.tcx.sess.span_fatal(ex.span,
97+
cx.tcx.sess.span_err(ex.span,
9798
"result of put must be" +
9899
" immutably rooted");
99100
}
@@ -153,7 +154,7 @@ fn check_call(&ctx cx, &@ast::expr f, &vec[@ast::expr] args, &scope sc) ->
153154
auto m =
154155
"passing a temporary value or \
155156
immutable field by mutable alias";
156-
cx.tcx.sess.span_fatal(arg.span, m);
157+
cx.tcx.sess.span_err(arg.span, m);
157158
}
158159
}
159160
}
@@ -176,7 +177,7 @@ fn check_call(&ctx cx, &@ast::expr f, &vec[@ast::expr] args, &scope sc) ->
176177
alt (f.node) {
177178
case (ast::expr_path(_)) {
178179
if (def_is_local(cx.tcx.def_map.get(f.id), true)) {
179-
cx.tcx.sess.span_fatal(f.span,
180+
cx.tcx.sess.span_err(f.span,
180181
#fmt("function may alias with \
181182
argument %u, which is not immutably rooted",
182183
unsafe_t_offsets.(0)));
@@ -195,7 +196,7 @@ fn check_call(&ctx cx, &@ast::expr f, &vec[@ast::expr] args, &scope sc) ->
195196
if (i != offset &&
196197
ty_can_unsafely_include(cx, unsafe, arg_t.ty, mut_alias))
197198
{
198-
cx.tcx.sess.span_fatal(args.(i).span,
199+
cx.tcx.sess.span_err(args.(i).span,
199200
#fmt("argument %u may alias with \
200201
argument %u, which is not immutably rooted",
201202
i, offset));
@@ -213,7 +214,7 @@ fn check_call(&ctx cx, &@ast::expr f, &vec[@ast::expr] args, &scope sc) ->
213214
}
214215
}
215216
if (mut_alias_to_root) {
216-
cx.tcx.sess.span_fatal(args.(root._0).span,
217+
cx.tcx.sess.span_err(args.(root._0).span,
217218
"passing a mutable alias to a \
218219
variable that roots another alias");
219220
}
@@ -239,7 +240,7 @@ fn check_tail_call(&ctx cx, &@ast::expr call) {
239240
alt (cx.local_map.find(dnum)) {
240241
case (some(arg(ast::alias(?mut)))) {
241242
if (mut_a && !mut) {
242-
cx.tcx.sess.span_fatal(args.(i).span,
243+
cx.tcx.sess.span_err(args.(i).span,
243244
"passing an immutable \
244245
alias by mutable alias");
245246
}
@@ -250,7 +251,7 @@ fn check_tail_call(&ctx cx, &@ast::expr call) {
250251
case (_) { ok = false; }
251252
}
252253
if (!ok) {
253-
cx.tcx.sess.span_fatal(args.(i).span,
254+
cx.tcx.sess.span_err(args.(i).span,
254255
"can not pass a local value by \
255256
alias to a tail call");
256257
}
@@ -386,10 +387,10 @@ fn check_lval(&@ctx cx, &@ast::expr dest, &scope sc, &vt[scope] v) {
386387
case (ast::expr_path(?p)) {
387388
auto dnum = ast::def_id_of_def(cx.tcx.def_map.get(dest.id))._1;
388389
if (is_immutable_alias(cx, sc, dnum)) {
389-
cx.tcx.sess.span_fatal(dest.span,
390+
cx.tcx.sess.span_err(dest.span,
390391
"assigning to immutable alias");
391392
} else if (is_immutable_objfield(cx, dnum)) {
392-
cx.tcx.sess.span_fatal(dest.span,
393+
cx.tcx.sess.span_err(dest.span,
393394
"assigning to immutable obj field");
394395
}
395396
for (restrict r in sc) {
@@ -402,15 +403,15 @@ fn check_lval(&@ctx cx, &@ast::expr dest, &scope sc, &vt[scope] v) {
402403
case (_) {
403404
auto root = expr_root(*cx, dest, false);
404405
if (vec::len(root.ds) == 0u) {
405-
cx.tcx.sess.span_fatal(dest.span, "assignment to non-lvalue");
406+
cx.tcx.sess.span_err(dest.span, "assignment to non-lvalue");
406407
} else if (!root.ds.(0).mut) {
407408
auto name =
408409
alt (root.ds.(0).kind) {
409410
case (unbox) { "box" }
410411
case (field) { "field" }
411412
case (index) { "vec content" }
412413
};
413-
cx.tcx.sess.span_fatal(dest.span,
414+
cx.tcx.sess.span_err(dest.span,
414415
"assignment to immutable " + name);
415416
}
416417
visit_expr(cx, dest, sc, v);
@@ -456,7 +457,7 @@ fn test_scope(&ctx cx, &scope sc, &restrict r, &ast::path p) {
456457
tup(sp, "taking the value of " + ast::path_name(vpt))
457458
}
458459
};
459-
cx.tcx.sess.span_fatal(msg._0,
460+
cx.tcx.sess.span_err(msg._0,
460461
msg._1 + " will invalidate alias " +
461462
ast::path_name(p) + ", which is still used");
462463
}

0 commit comments

Comments
 (0)