parent
cf9ed08a50
commit
43427dae0c
@ -33,8 +33,8 @@ tag output_type {
|
||||
fn llvm_err(session::session sess, str msg) {
|
||||
auto buf = llvm::LLVMRustGetLastError();
|
||||
if (buf as uint == 0u) {
|
||||
sess.err(msg);
|
||||
} else { sess.err(msg + ": " + str::str_from_cstr(buf)); }
|
||||
sess.fatal(msg);
|
||||
} else { sess.fatal(msg + ": " + str::str_from_cstr(buf)); }
|
||||
fail;
|
||||
}
|
||||
|
||||
@ -276,7 +276,7 @@ fn get_crate_meta_export(&session::session sess, &ast::crate c, str k,
|
||||
}
|
||||
case (1u) { ret v.(0).node.value; }
|
||||
case (_) {
|
||||
sess.span_err(v.(1).span, #fmt("duplicate meta '%s'", k));
|
||||
sess.span_fatal(v.(1).span, #fmt("duplicate meta '%s'", k));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -59,7 +59,7 @@ fn parse_input(session::session sess, parser::parser p, str input) ->
|
||||
parser::parse_crate_from_crate_file(p)
|
||||
} else if (str::ends_with(input, ".rs")) {
|
||||
parser::parse_crate_from_source_file(p)
|
||||
} else { sess.err("unknown input file type: " + input); fail };
|
||||
} else { sess.fatal("unknown input file type: " + input); fail };
|
||||
}
|
||||
|
||||
fn time[T](bool do_it, str what, fn() -> T thunk) -> T {
|
||||
@ -282,7 +282,7 @@ fn parse_pretty(session::session sess, &str name) -> pp_mode {
|
||||
} else if (str::eq(name, "typed")) {
|
||||
ret ppm_typed;
|
||||
} else if (str::eq(name, "identified")) { ret ppm_identified; }
|
||||
sess.err("argument to `pretty` must be one of `normal`, `typed`, or " +
|
||||
sess.fatal("argument to `pretty` must be one of `normal`, `typed`, or " +
|
||||
"`identified`");
|
||||
}
|
||||
|
||||
@ -321,16 +321,16 @@ fn main(vec[str] args) {
|
||||
auto glue = opt_present(match, "glue");
|
||||
if (glue) {
|
||||
if (n_inputs > 0u) {
|
||||
sess.err("No input files allowed with --glue.");
|
||||
sess.fatal("No input files allowed with --glue.");
|
||||
}
|
||||
auto out = option::from_maybe[str]("glue.bc", output_file);
|
||||
middle::trans::make_common_glue(sess, out);
|
||||
ret;
|
||||
}
|
||||
if (n_inputs == 0u) {
|
||||
sess.err("No input filename given.");
|
||||
sess.fatal("No input filename given.");
|
||||
} else if (n_inputs > 1u) {
|
||||
sess.err("Multiple input filenames provided.");
|
||||
sess.fatal("Multiple input filenames provided.");
|
||||
}
|
||||
auto ifile = match.free.(0);
|
||||
let str saved_out_filename = "";
|
||||
|
@ -70,13 +70,13 @@ obj session(ast::crate_num cnum,
|
||||
fn get_targ_cfg() -> @config { ret targ_cfg; }
|
||||
fn get_opts() -> @options { ret opts; }
|
||||
fn get_targ_crate_num() -> ast::crate_num { ret cnum; }
|
||||
fn span_err(span sp, str msg) -> ! {
|
||||
fn span_fatal(span sp, str msg) -> ! {
|
||||
// FIXME: Use constants, but rustboot doesn't know how to export them.
|
||||
|
||||
emit_diagnostic(some(sp), msg, "error", 9u8, cm);
|
||||
fail;
|
||||
}
|
||||
fn err(str msg) -> ! {
|
||||
fn fatal(str msg) -> ! {
|
||||
emit_diagnostic(none[span], msg, "error", 9u8, cm);
|
||||
fail;
|
||||
}
|
||||
@ -94,10 +94,10 @@ obj session(ast::crate_num cnum,
|
||||
emit_diagnostic(some(sp), msg, "note", 10u8, cm);
|
||||
}
|
||||
fn span_bug(span sp, str msg) -> ! {
|
||||
self.span_err(sp, #fmt("internal compiler error %s", msg));
|
||||
self.span_fatal(sp, #fmt("internal compiler error %s", msg));
|
||||
}
|
||||
fn bug(str msg) -> ! {
|
||||
self.err(#fmt("internal compiler error %s", msg));
|
||||
self.fatal(#fmt("internal compiler error %s", msg));
|
||||
}
|
||||
fn span_unimpl(span sp, str msg) -> ! {
|
||||
self.span_bug(sp, "unimplemented " + msg);
|
||||
|
@ -63,7 +63,7 @@ fn lookup(session::session sess, env e, span sp, ident i) -> val {
|
||||
for (tup(ident, val) pair in e) {
|
||||
if (str::eq(i, pair._0)) { ret pair._1; }
|
||||
}
|
||||
sess.span_err(sp, "unknown variable: " + i)
|
||||
sess.span_fatal(sp, "unknown variable: " + i)
|
||||
}
|
||||
|
||||
fn eval_lit(ctx cx, span sp, @ast::lit lit) -> val {
|
||||
@ -71,7 +71,7 @@ fn eval_lit(ctx cx, span sp, @ast::lit lit) -> val {
|
||||
case (ast::lit_bool(?b)) { val_bool(b) }
|
||||
case (ast::lit_int(?i)) { val_int(i) }
|
||||
case (ast::lit_str(?s, _)) { val_str(s) }
|
||||
case (_) { cx.sess.span_err(sp, "evaluating unsupported literal") }
|
||||
case (_) { cx.sess.span_fatal(sp, "evaluating unsupported literal") }
|
||||
}
|
||||
}
|
||||
|
||||
@ -82,7 +82,7 @@ fn eval_expr(ctx cx, env e, @ast::expr x) -> val {
|
||||
vec::len[@ast::ty](pth.node.types) == 0u) {
|
||||
ret lookup(cx.sess, e, x.span, pth.node.idents.(0));
|
||||
}
|
||||
cx.sess.span_err(x.span, "evaluating structured path-name");
|
||||
cx.sess.span_fatal(x.span, "evaluating structured path-name");
|
||||
}
|
||||
case (ast::expr_lit(?lit, _)) { ret eval_lit(cx, x.span, lit); }
|
||||
case (ast::expr_unary(?op, ?a, _)) {
|
||||
@ -90,10 +90,10 @@ fn eval_expr(ctx cx, env e, @ast::expr x) -> val {
|
||||
alt (op) {
|
||||
case (ast::not) {
|
||||
if (val_is_bool(av)) { ret val_bool(!val_as_bool(av)); }
|
||||
cx.sess.span_err(x.span, "bad types in '!' expression");
|
||||
cx.sess.span_fatal(x.span, "bad types in '!' expression");
|
||||
}
|
||||
case (_) {
|
||||
cx.sess.span_err(x.span, "evaluating unsupported unop");
|
||||
cx.sess.span_fatal(x.span, "evaluating unsupported unop");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -108,43 +108,45 @@ fn eval_expr(ctx cx, env e, @ast::expr x) -> val {
|
||||
if (val_is_str(av) && val_is_str(bv)) {
|
||||
ret val_str(val_as_str(av) + val_as_str(bv));
|
||||
}
|
||||
cx.sess.span_err(x.span, "bad types in '+' expression");
|
||||
cx.sess.span_fatal(x.span, "bad types in '+' expression");
|
||||
}
|
||||
case (ast::sub) {
|
||||
if (val_is_int(av) && val_is_int(bv)) {
|
||||
ret val_int(val_as_int(av) - val_as_int(bv));
|
||||
}
|
||||
cx.sess.span_err(x.span, "bad types in '-' expression");
|
||||
cx.sess.span_fatal(x.span, "bad types in '-' expression");
|
||||
}
|
||||
case (ast::mul) {
|
||||
if (val_is_int(av) && val_is_int(bv)) {
|
||||
ret val_int(val_as_int(av) * val_as_int(bv));
|
||||
}
|
||||
cx.sess.span_err(x.span, "bad types in '*' expression");
|
||||
cx.sess.span_fatal(x.span, "bad types in '*' expression");
|
||||
}
|
||||
case (ast::div) {
|
||||
if (val_is_int(av) && val_is_int(bv)) {
|
||||
ret val_int(val_as_int(av) / val_as_int(bv));
|
||||
}
|
||||
cx.sess.span_err(x.span, "bad types in '/' expression");
|
||||
cx.sess.span_fatal(x.span, "bad types in '/' expression");
|
||||
}
|
||||
case (ast::rem) {
|
||||
if (val_is_int(av) && val_is_int(bv)) {
|
||||
ret val_int(val_as_int(av) % val_as_int(bv));
|
||||
}
|
||||
cx.sess.span_err(x.span, "bad types in '%' expression");
|
||||
cx.sess.span_fatal(x.span, "bad types in '%' expression");
|
||||
}
|
||||
case (ast::and) {
|
||||
if (val_is_bool(av) && val_is_bool(bv)) {
|
||||
ret val_bool(val_as_bool(av) && val_as_bool(bv));
|
||||
}
|
||||
cx.sess.span_err(x.span, "bad types in '&&' expression");
|
||||
cx.sess.span_fatal(x.span,
|
||||
"bad types in '&&' expression");
|
||||
}
|
||||
case (ast::or) {
|
||||
if (val_is_bool(av) && val_is_bool(bv)) {
|
||||
ret val_bool(val_as_bool(av) || val_as_bool(bv));
|
||||
}
|
||||
cx.sess.span_err(x.span, "bad types in '||' expression");
|
||||
cx.sess.span_fatal(x.span,
|
||||
"bad types in '||' expression");
|
||||
}
|
||||
case (ast::eq) {
|
||||
ret val_bool(val_eq(cx.sess, x.span, av, bv));
|
||||
@ -153,12 +155,13 @@ fn eval_expr(ctx cx, env e, @ast::expr x) -> val {
|
||||
ret val_bool(!val_eq(cx.sess, x.span, av, bv));
|
||||
}
|
||||
case (_) {
|
||||
cx.sess.span_err(x.span, "evaluating unsupported binop");
|
||||
cx.sess.span_fatal(x.span,
|
||||
"evaluating unsupported binop");
|
||||
}
|
||||
}
|
||||
}
|
||||
case (_) {
|
||||
cx.sess.span_err(x.span, "evaluating unsupported expression");
|
||||
cx.sess.span_fatal(x.span, "evaluating unsupported expression");
|
||||
}
|
||||
}
|
||||
fail;
|
||||
@ -171,7 +174,7 @@ fn val_eq(session::session sess, span sp, val av, val bv) -> bool {
|
||||
val_as_int(av) == val_as_int(bv)
|
||||
} else if (val_is_str(av) && val_is_str(bv)) {
|
||||
str::eq(val_as_str(av), val_as_str(bv))
|
||||
} else { sess.span_err(sp, "bad types in comparison") }
|
||||
} else { sess.span_fatal(sp, "bad types in comparison") }
|
||||
}
|
||||
|
||||
fn eval_crate_directives(ctx cx, env e, vec[@ast::crate_directive] cdirs,
|
||||
@ -200,7 +203,7 @@ fn eval_crate_directive_block(ctx cx, env e, &ast::block blk, str prefix,
|
||||
eval_crate_directive(cx, e, cdir, prefix, view_items, items);
|
||||
}
|
||||
case (_) {
|
||||
cx.sess.span_err(s.span,
|
||||
cx.sess.span_fatal(s.span,
|
||||
"unsupported stmt in crate-directive block");
|
||||
}
|
||||
}
|
||||
@ -214,7 +217,7 @@ fn eval_crate_directive_expr(ctx cx, env e, @ast::expr x, str prefix,
|
||||
case (ast::expr_if(?cond, ?thn, ?elopt, _)) {
|
||||
auto cv = eval_expr(cx, e, cond);
|
||||
if (!val_is_bool(cv)) {
|
||||
cx.sess.span_err(x.span, "bad cond type in 'if'");
|
||||
cx.sess.span_fatal(x.span, "bad cond type in 'if'");
|
||||
}
|
||||
if (val_as_bool(cv)) {
|
||||
ret eval_crate_directive_block(cx, e, thn, prefix, view_items,
|
||||
@ -249,18 +252,18 @@ fn eval_crate_directive_expr(ctx cx, env e, @ast::expr x, str prefix,
|
||||
items);
|
||||
}
|
||||
case (_) {
|
||||
cx.sess.span_err(arm.pat.span,
|
||||
cx.sess.span_fatal(arm.pat.span,
|
||||
"bad pattern type in 'alt'");
|
||||
}
|
||||
}
|
||||
}
|
||||
cx.sess.span_err(x.span, "no cases matched in 'alt'");
|
||||
cx.sess.span_fatal(x.span, "no cases matched in 'alt'");
|
||||
}
|
||||
case (ast::expr_block(?block, _)) {
|
||||
ret eval_crate_directive_block(cx, e, block, prefix, view_items,
|
||||
items);
|
||||
}
|
||||
case (_) { cx.sess.span_err(x.span, "unsupported expr type"); }
|
||||
case (_) { cx.sess.span_fatal(x.span, "unsupported expr type"); }
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -31,21 +31,23 @@ type next_ann_fn = fn() -> ast::ann ;
|
||||
// Provides a limited set of services necessary for syntax extensions
|
||||
// to do their thing
|
||||
type ext_ctxt =
|
||||
rec(span_msg_fn span_err, span_msg_fn span_unimpl, next_ann_fn next_ann);
|
||||
rec(span_msg_fn span_fatal,
|
||||
span_msg_fn span_unimpl,
|
||||
next_ann_fn next_ann);
|
||||
|
||||
fn mk_ctxt(parser parser) -> ext_ctxt {
|
||||
auto sess = parser.get_session();
|
||||
fn ext_span_err_(session sess, span sp, str msg) -> ! {
|
||||
sess.span_err(sp, msg);
|
||||
fn ext_span_fatal_(session sess, span sp, str msg) -> ! {
|
||||
sess.span_fatal(sp, msg);
|
||||
}
|
||||
auto ext_span_err = bind ext_span_err_(sess, _, _);
|
||||
auto ext_span_fatal = bind ext_span_fatal_(sess, _, _);
|
||||
fn ext_span_unimpl_(session sess, span sp, str msg) -> ! {
|
||||
sess.span_unimpl(sp, msg);
|
||||
}
|
||||
auto ext_span_unimpl = bind ext_span_unimpl_(sess, _, _);
|
||||
fn ext_next_ann_(parser parser) -> ast::ann { parser.get_ann() }
|
||||
auto ext_next_ann = bind ext_next_ann_(parser);
|
||||
ret rec(span_err=ext_span_err,
|
||||
ret rec(span_fatal=ext_span_fatal,
|
||||
span_unimpl=ext_span_unimpl,
|
||||
next_ann=ext_next_ann);
|
||||
}
|
||||
|
@ -16,7 +16,7 @@ export expand_syntax_ext;
|
||||
fn expand_syntax_ext(&ext_ctxt cx, common::span sp, &vec[@ast::expr] args,
|
||||
option::t[str] body) -> @ast::expr {
|
||||
if (vec::len[@ast::expr](args) != 1u) {
|
||||
cx.span_err(sp, "malformed #env call");
|
||||
cx.span_fatal(sp, "malformed #env call");
|
||||
}
|
||||
// FIXME: if this was more thorough it would manufacture an
|
||||
// option::t[str] rather than just an maybe-empty string.
|
||||
@ -35,10 +35,10 @@ fn expr_to_str(&ext_ctxt cx, @ast::expr expr) -> str {
|
||||
case (ast::expr_lit(?l, _)) {
|
||||
alt (l.node) {
|
||||
case (ast::lit_str(?s, _)) { ret s; }
|
||||
case (_) { cx.span_err(l.span, "malformed #env call"); }
|
||||
case (_) { cx.span_fatal(l.span, "malformed #env call"); }
|
||||
}
|
||||
}
|
||||
case (_) { cx.span_err(expr.span, "malformed #env call"); }
|
||||
case (_) { cx.span_fatal(expr.span, "malformed #env call"); }
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -18,14 +18,14 @@ export expand_syntax_ext;
|
||||
fn expand_syntax_ext(&ext_ctxt cx, common::span sp, &vec[@ast::expr] args,
|
||||
option::t[str] body) -> @ast::expr {
|
||||
if (vec::len[@ast::expr](args) == 0u) {
|
||||
cx.span_err(sp, "#fmt requires a format string");
|
||||
cx.span_fatal(sp, "#fmt requires a format string");
|
||||
}
|
||||
auto fmt = expr_to_str(cx, args.(0));
|
||||
auto fmtspan = args.(0).span;
|
||||
log "Format string:";
|
||||
log fmt;
|
||||
fn parse_fmt_err_(&ext_ctxt cx, common::span sp, str msg) -> ! {
|
||||
cx.span_err(sp, msg);
|
||||
cx.span_fatal(sp, msg);
|
||||
}
|
||||
auto parse_fmt_err = bind parse_fmt_err_(cx, fmtspan, _);
|
||||
auto pieces = parse_fmt_string(fmt, parse_fmt_err);
|
||||
@ -40,10 +40,10 @@ fn expr_to_str(&ext_ctxt cx, @ast::expr expr) -> str {
|
||||
case (ast::expr_lit(?l, _)) {
|
||||
alt (l.node) {
|
||||
case (ast::lit_str(?s, _)) { ret s; }
|
||||
case (_) { cx.span_err(l.span, err_msg); }
|
||||
case (_) { cx.span_fatal(l.span, err_msg); }
|
||||
}
|
||||
}
|
||||
case (_) { cx.span_err(expr.span, err_msg); }
|
||||
case (_) { cx.span_fatal(expr.span, err_msg); }
|
||||
}
|
||||
}
|
||||
|
||||
@ -236,14 +236,14 @@ fn pieces_to_expr(&ext_ctxt cx, common::span sp, vec[piece] pieces,
|
||||
case (flag_left_justify) { }
|
||||
case (flag_sign_always) {
|
||||
if (!is_signed_type(cnv)) {
|
||||
cx.span_err(sp,
|
||||
cx.span_fatal(sp,
|
||||
"+ flag only valid in " +
|
||||
"signed #fmt conversion");
|
||||
}
|
||||
}
|
||||
case (flag_space_for_sign) {
|
||||
if (!is_signed_type(cnv)) {
|
||||
cx.span_err(sp,
|
||||
cx.span_fatal(sp,
|
||||
"space flag only valid in " +
|
||||
"signed #fmt conversions");
|
||||
}
|
||||
@ -361,7 +361,7 @@ fn pieces_to_expr(&ext_ctxt cx, common::span sp, vec[piece] pieces,
|
||||
case (piece_conv(?conv)) {
|
||||
n += 1u;
|
||||
if (n >= nargs) {
|
||||
cx.span_err(sp,
|
||||
cx.span_fatal(sp,
|
||||
"not enough arguments to #fmt " +
|
||||
"for the given format string");
|
||||
}
|
||||
@ -376,7 +376,7 @@ fn pieces_to_expr(&ext_ctxt cx, common::span sp, vec[piece] pieces,
|
||||
auto expected_nargs = n + 1u; // n conversions + the fmt string
|
||||
|
||||
if (expected_nargs < nargs) {
|
||||
cx.span_err(sp,
|
||||
cx.span_fatal(sp,
|
||||
#fmt("too many arguments to #fmt. found %u, expected %u",
|
||||
nargs, expected_nargs));
|
||||
}
|
||||
|
@ -75,7 +75,7 @@ fn new_reader(session sess, io::reader rdr, codemap::filemap filemap,
|
||||
fn get_interner() -> @interner::interner[str] { ret itr; }
|
||||
fn get_col() -> uint { ret col; }
|
||||
fn get_filemap() -> codemap::filemap { ret fm; }
|
||||
fn err(str m) { sess.span_err(rec(lo=chpos, hi=chpos), m); }
|
||||
fn err(str m) { sess.span_fatal(rec(lo=chpos, hi=chpos), m); }
|
||||
}
|
||||
auto file = str::unsafe_from_bytes(rdr.read_whole_stream());
|
||||
let vec[str] strs = [];
|
||||
|
@ -78,7 +78,7 @@ fn new_parser(session::session sess, eval::env env, ast::def_id initial_def,
|
||||
lo = rdr.get_mark_chpos();
|
||||
hi = rdr.get_chpos();
|
||||
}
|
||||
fn err(str m) -> ! { sess.span_err(rec(lo=lo, hi=hi), m); }
|
||||
fn err(str m) -> ! { sess.span_fatal(rec(lo=lo, hi=hi), m); }
|
||||
fn restrict(restriction r) { res = r; }
|
||||
fn get_restriction() -> restriction { ret res; }
|
||||
fn get_session() -> session::session { ret sess; }
|
||||
@ -353,7 +353,7 @@ fn parse_ty_field(&parser p) -> ast::ty_field {
|
||||
fn ident_index(&parser p, &vec[ast::arg] args, &ast::ident i) -> uint {
|
||||
auto j = 0u;
|
||||
for (ast::arg a in args) { if (a.ident == i) { ret j; } j += 1u; }
|
||||
p.get_session().span_err(p.get_span(),
|
||||
p.get_session().span_fatal(p.get_span(),
|
||||
"Unbound variable " + i + " in constraint arg");
|
||||
}
|
||||
|
||||
|
@ -92,7 +92,7 @@ fn visit_expr(@ctx cx, &@ast::expr ex, &scope sc, &vt[scope] v) {
|
||||
case (some(?ex)) {
|
||||
auto root = expr_root(*cx, ex, false);
|
||||
if (mut_field(root.ds)) {
|
||||
cx.tcx.sess.span_err(ex.span,
|
||||
cx.tcx.sess.span_fatal(ex.span,
|
||||
"result of put must be" +
|
||||
" immutably rooted");
|
||||
}
|
||||
@ -148,7 +148,7 @@ fn check_call(&ctx cx, &@ast::expr f, &vec[@ast::expr] args, &scope sc) ->
|
||||
auto m =
|
||||
"passing a temporary value or \
|
||||
immutable field by mutable alias";
|
||||
cx.tcx.sess.span_err(arg.span, m);
|
||||
cx.tcx.sess.span_fatal(arg.span, m);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -171,7 +171,7 @@ fn check_call(&ctx cx, &@ast::expr f, &vec[@ast::expr] args, &scope sc) ->
|
||||
alt (f.node) {
|
||||
case (ast::expr_path(_, ?ann)) {
|
||||
if (def_is_local(cx.tcx.def_map.get(ann.id), true)) {
|
||||
cx.tcx.sess.span_err(f.span,
|
||||
cx.tcx.sess.span_fatal(f.span,
|
||||
#fmt("function may alias with \
|
||||
argument %u, which is not immutably rooted",
|
||||
unsafe_t_offsets.(0)));
|
||||
@ -190,7 +190,7 @@ fn check_call(&ctx cx, &@ast::expr f, &vec[@ast::expr] args, &scope sc) ->
|
||||
if (i != offset &&
|
||||
ty_can_unsafely_include(cx, unsafe, arg_t.ty, mut_alias))
|
||||
{
|
||||
cx.tcx.sess.span_err(args.(i).span,
|
||||
cx.tcx.sess.span_fatal(args.(i).span,
|
||||
#fmt("argument %u may alias with \
|
||||
argument %u, which is not immutably rooted",
|
||||
i, offset));
|
||||
@ -208,7 +208,7 @@ fn check_call(&ctx cx, &@ast::expr f, &vec[@ast::expr] args, &scope sc) ->
|
||||
}
|
||||
}
|
||||
if (mut_alias_to_root) {
|
||||
cx.tcx.sess.span_err(args.(root._0).span,
|
||||
cx.tcx.sess.span_fatal(args.(root._0).span,
|
||||
"passing a mutable alias to a \
|
||||
variable that roots another alias");
|
||||
}
|
||||
@ -377,10 +377,10 @@ fn check_assign(&@ctx cx, &@ast::expr dest, &@ast::expr src, &scope sc,
|
||||
case (ast::expr_path(?p, ?ann)) {
|
||||
auto dnum = ast::def_id_of_def(cx.tcx.def_map.get(ann.id))._1;
|
||||
if (is_immutable_alias(cx, sc, dnum)) {
|
||||
cx.tcx.sess.span_err(dest.span,
|
||||
cx.tcx.sess.span_fatal(dest.span,
|
||||
"assigning to immutable alias");
|
||||
} else if (is_immutable_objfield(cx, dnum)) {
|
||||
cx.tcx.sess.span_err(dest.span,
|
||||
cx.tcx.sess.span_fatal(dest.span,
|
||||
"assigning to immutable obj field");
|
||||
}
|
||||
auto var_t = ty::expr_ty(*cx.tcx, dest);
|
||||
@ -394,7 +394,7 @@ fn check_assign(&@ctx cx, &@ast::expr dest, &@ast::expr src, &scope sc,
|
||||
case (_) {
|
||||
auto root = expr_root(*cx, dest, false);
|
||||
if (vec::len(root.ds) == 0u) {
|
||||
cx.tcx.sess.span_err(dest.span, "assignment to non-lvalue");
|
||||
cx.tcx.sess.span_fatal(dest.span, "assignment to non-lvalue");
|
||||
} else if (!root.ds.(0).mut) {
|
||||
auto name =
|
||||
alt (root.ds.(0).kind) {
|
||||
@ -402,7 +402,7 @@ fn check_assign(&@ctx cx, &@ast::expr dest, &@ast::expr src, &scope sc,
|
||||
case (field) { "field" }
|
||||
case (index) { "vec content" }
|
||||
};
|
||||
cx.tcx.sess.span_err(dest.span,
|
||||
cx.tcx.sess.span_fatal(dest.span,
|
||||
"assignment to immutable " + name);
|
||||
}
|
||||
visit_expr(cx, dest, sc, v);
|
||||
@ -441,7 +441,7 @@ fn test_scope(&ctx cx, &scope sc, &restrict r, &ast::path p) {
|
||||
tup(sp, "taking the value of " + ast::path_name(vpt))
|
||||
}
|
||||
};
|
||||
cx.tcx.sess.span_err(msg._0,
|
||||
cx.tcx.sess.span_fatal(msg._0,
|
||||
msg._1 + " will invalidate alias " +
|
||||
ast::path_name(p) + ", which is still used");
|
||||
}
|
||||
|
@ -307,7 +307,7 @@ fn resolve_names(&@env e, &@ast::crate c) {
|
||||
e.def_map.insert(a.id, fnd);
|
||||
}
|
||||
case (_) {
|
||||
e.sess.span_err(p.span,
|
||||
e.sess.span_fatal(p.span,
|
||||
"not a tag variant: " +
|
||||
ast::path_name(p));
|
||||
}
|
||||
@ -380,7 +380,7 @@ fn follow_import(&env e, &scopes sc, vec[ident] path, &span sp) -> def {
|
||||
case (ast::def_mod(?def_id)) { ret dcur; }
|
||||
case (ast::def_native_mod(?def_id)) { ret dcur; }
|
||||
case (_) {
|
||||
e.sess.span_err(sp,
|
||||
e.sess.span_fatal(sp,
|
||||
str::connect(path, "::") +
|
||||
" does not name a module.");
|
||||
}
|
||||
@ -399,7 +399,7 @@ fn resolve_constr(@env e, &def_id d_id, &@ast::constr c, &scopes sc,
|
||||
add_constr(e, d_id, new_constr);
|
||||
}
|
||||
case (_) {
|
||||
e.sess.span_err(c.span,
|
||||
e.sess.span_fatal(c.span,
|
||||
"Non-predicate in constraint: " +
|
||||
ty::path_to_str(c.node.path));
|
||||
}
|
||||
@ -478,7 +478,7 @@ fn ns_name(namespace ns) -> str {
|
||||
}
|
||||
|
||||
fn unresolved(&env e, &span sp, &ident id, &str kind) -> ! {
|
||||
e.sess.span_err(sp, "unresolved " + kind + ": " + id);
|
||||
e.sess.span_fatal(sp, "unresolved " + kind + ": " + id);
|
||||
}
|
||||
|
||||
|
||||
@ -599,7 +599,7 @@ fn lookup_in_scope(&env e, scopes sc, &span sp, &ident id, namespace ns) ->
|
||||
auto df = option::get(fnd);
|
||||
if (left_fn && def_is_local(df) ||
|
||||
left_fn_level2 && def_is_obj_field(df)) {
|
||||
e.sess.span_err(sp,
|
||||
e.sess.span_fatal(sp,
|
||||
"attempted dynamic \
|
||||
environment-capture");
|
||||
}
|
||||
@ -806,7 +806,7 @@ fn lookup_import(&env e, def_id defid, namespace ns) -> option::t[def] {
|
||||
resolve_import(e, item, sc);
|
||||
ret lookup_import(e, defid, ns);
|
||||
}
|
||||
case (resolving(?sp)) { e.sess.span_err(sp, "cyclic import"); }
|
||||
case (resolving(?sp)) { e.sess.span_fatal(sp, "cyclic import"); }
|
||||
case (resolved(?val, ?typ, ?md)) {
|
||||
ret alt (ns) {
|
||||
case (ns_value) { val }
|
||||
@ -881,7 +881,7 @@ fn lookup_glob_in_mod(&env e, @indexed_mod info, &span sp, &ident id,
|
||||
}
|
||||
}
|
||||
}
|
||||
e.sess.span_err(sp,
|
||||
e.sess.span_fatal(sp,
|
||||
"'" + id + "' is glob-imported from" +
|
||||
" multiple different modules.");
|
||||
}
|
||||
@ -1086,7 +1086,7 @@ fn check_mod_name(&env e, &ident name, list[mod_index_entry] entries) {
|
||||
auto saw_type = false;
|
||||
auto saw_value = false;
|
||||
fn dup(&env e, &span sp, &str word, &ident name) {
|
||||
e.sess.span_err(sp, "duplicate definition of " + word + name);
|
||||
e.sess.span_fatal(sp, "duplicate definition of " + word + name);
|
||||
}
|
||||
while (true) {
|
||||
alt (entries) {
|
||||
@ -1222,7 +1222,7 @@ fn checker(&env e, str kind) -> checker {
|
||||
fn add_name(&checker ch, &span sp, &ident id) {
|
||||
for (ident s in ch.seen) {
|
||||
if (str::eq(s, id)) {
|
||||
ch.sess.span_err(sp, "duplicate " + ch.kind + " name: " + id);
|
||||
ch.sess.span_fatal(sp, "duplicate " + ch.kind + " name: " + id);
|
||||
}
|
||||
}
|
||||
vec::push(ch.seen, id);
|
||||
|
@ -677,7 +677,7 @@ fn T_opaque_chan_ptr() -> TypeRef { ret T_ptr(T_i8()); }
|
||||
// TODO: Enforce via a predicate.
|
||||
fn type_of(&@crate_ctxt cx, &span sp, &ty::t t) -> TypeRef {
|
||||
if (ty::type_has_dynamic_size(cx.tcx, t)) {
|
||||
cx.sess.span_err(sp,
|
||||
cx.sess.span_fatal(sp,
|
||||
"type_of() called on a type with dynamic size: " +
|
||||
ty_to_str(cx.tcx, t));
|
||||
}
|
||||
@ -881,7 +881,7 @@ fn type_of_inner(&@crate_ctxt cx, &span sp, &ty::t t) -> TypeRef {
|
||||
llty = abs_pair;
|
||||
}
|
||||
case (ty::ty_var(_)) {
|
||||
cx.tcx.sess.span_err(sp, "trans::type_of called on ty_var");
|
||||
cx.tcx.sess.span_fatal(sp, "trans::type_of called on ty_var");
|
||||
}
|
||||
case (ty::ty_param(_)) { llty = T_i8(); }
|
||||
case (ty::ty_type) { llty = T_ptr(T_tydesc(cx.tn)); }
|
||||
@ -1226,7 +1226,7 @@ fn simplify_type(&@crate_ctxt ccx, &ty::t typ) -> ty::t {
|
||||
// Computes the size of the data part of a non-dynamically-sized tag.
|
||||
fn static_size_of_tag(&@crate_ctxt cx, &span sp, &ty::t t) -> uint {
|
||||
if (ty::type_has_dynamic_size(cx.tcx, t)) {
|
||||
cx.tcx.sess.span_err(sp,
|
||||
cx.tcx.sess.span_fatal(sp,
|
||||
"dynamically sized type passed to " +
|
||||
"static_size_of_tag()");
|
||||
}
|
||||
@ -1236,7 +1236,7 @@ fn static_size_of_tag(&@crate_ctxt cx, &span sp, &ty::t t) -> uint {
|
||||
alt (ty::struct(cx.tcx, t)) {
|
||||
case (ty::ty_tag(?tid_, ?subtys_)) { tid = tid_; subtys = subtys_; }
|
||||
case (_) {
|
||||
cx.tcx.sess.span_err(sp,
|
||||
cx.tcx.sess.span_fatal(sp,
|
||||
"non-tag passed to " +
|
||||
"static_size_of_tag()");
|
||||
}
|
||||
@ -5983,7 +5983,7 @@ fn trans_log(int lvl, &@block_ctxt cx, &@ast::expr e) -> result {
|
||||
case (_) {
|
||||
// FIXME: Support these types.
|
||||
|
||||
cx.fcx.lcx.ccx.sess.span_err(e.span,
|
||||
cx.fcx.lcx.ccx.sess.span_fatal(e.span,
|
||||
"log called on unsupported type "
|
||||
+
|
||||
ty_to_str(cx.fcx.lcx.ccx.tcx,
|
||||
@ -6088,7 +6088,7 @@ fn trans_break_cont(&span sp, &@block_ctxt cx, bool to_end) -> result {
|
||||
alt ({ cleanup_cx.parent }) {
|
||||
case (parent_some(?cx)) { cleanup_cx = cx; }
|
||||
case (parent_none) {
|
||||
cx.fcx.lcx.ccx.sess.span_err(sp,
|
||||
cx.fcx.lcx.ccx.sess.span_fatal(sp,
|
||||
if (to_end) {
|
||||
"Break"
|
||||
} else { "Cont" } +
|
||||
@ -7621,7 +7621,7 @@ fn decl_fn_and_pair(&@crate_ctxt ccx, &span sp, vec[str] path, str flav,
|
||||
register_fn_pair(ccx, ps, llfty, llfn, id);
|
||||
if (is_main) {
|
||||
if (ccx.main_fn != none[ValueRef]) {
|
||||
ccx.sess.span_err(sp, "multiple 'main' functions");
|
||||
ccx.sess.span_fatal(sp, "multiple 'main' functions");
|
||||
}
|
||||
llvm::LLVMSetLinkage(llfn,
|
||||
lib::llvm::LLVMExternalLinkage as llvm::Linkage);
|
||||
|
@ -560,7 +560,7 @@ fn expr_to_constr_arg(ty::ctxt tcx, &@expr e) -> @constr_arg_use {
|
||||
}
|
||||
case (expr_lit(?l, _)) { ret @respan(e.span, carg_lit(l)); }
|
||||
case (_) {
|
||||
tcx.sess.span_err(e.span,
|
||||
tcx.sess.span_fatal(e.span,
|
||||
"Arguments to constrained functions must be "
|
||||
+ "literals or local variables");
|
||||
}
|
||||
@ -587,7 +587,7 @@ fn expr_to_constr(ty::ctxt tcx, &@expr e) -> constr {
|
||||
exprs_to_constr_args(tcx, args))));
|
||||
}
|
||||
case (_) {
|
||||
tcx.sess.span_err(operator.span,
|
||||
tcx.sess.span_fatal(operator.span,
|
||||
"Internal error: " +
|
||||
" ill-formed operator \
|
||||
in predicate");
|
||||
@ -595,7 +595,7 @@ fn expr_to_constr(ty::ctxt tcx, &@expr e) -> constr {
|
||||
}
|
||||
}
|
||||
case (_) {
|
||||
tcx.sess.span_err(e.span,
|
||||
tcx.sess.span_fatal(e.span,
|
||||
"Internal error: " + " ill-formed predicate");
|
||||
}
|
||||
}
|
||||
@ -626,7 +626,8 @@ fn substitute_arg(&ty::ctxt cx, &vec[@expr] actuals, @ast::constr_arg a) ->
|
||||
if (i < num_actuals) {
|
||||
ret expr_to_constr_arg(cx, actuals.(i));
|
||||
} else {
|
||||
cx.sess.span_err(a.span, "Constraint argument out of bounds");
|
||||
cx.sess.span_fatal(a.span,
|
||||
"Constraint argument out of bounds");
|
||||
}
|
||||
}
|
||||
case (carg_base) { ret @respan(a.span, carg_base); }
|
||||
@ -636,7 +637,7 @@ fn substitute_arg(&ty::ctxt cx, &vec[@expr] actuals, @ast::constr_arg a) ->
|
||||
|
||||
fn path_to_ident(&ty::ctxt cx, &path p) -> ident {
|
||||
alt (vec::last(p.node.idents)) {
|
||||
case (none) { cx.sess.span_err(p.span, "Malformed path"); }
|
||||
case (none) { cx.sess.span_fatal(p.span, "Malformed path"); }
|
||||
case (some(?i)) { ret i; }
|
||||
}
|
||||
}
|
||||
|
@ -85,7 +85,7 @@ fn check_states_expr(&fn_ctxt fcx, &@expr e) {
|
||||
s += bitv_to_str(fcx, prec);
|
||||
s += "\nPrestate:\n";
|
||||
s += bitv_to_str(fcx, pres);
|
||||
fcx.ccx.tcx.sess.span_err(e.span, s);
|
||||
fcx.ccx.tcx.sess.span_fatal(e.span, s);
|
||||
}
|
||||
}
|
||||
|
||||
@ -114,7 +114,7 @@ fn check_states_stmt(&fn_ctxt fcx, &@stmt s) {
|
||||
ss += bitv_to_str(fcx, prec);
|
||||
ss += "\nPrestate: \n";
|
||||
ss += bitv_to_str(fcx, pres);
|
||||
fcx.ccx.tcx.sess.span_err(s.span, ss);
|
||||
fcx.ccx.tcx.sess.span_fatal(s.span, ss);
|
||||
}
|
||||
}
|
||||
|
||||
@ -153,7 +153,7 @@ fn check_states_against_conditions(&fn_ctxt fcx, &_fn f, &ann a,
|
||||
"In function " + fcx.name +
|
||||
", not all control paths \
|
||||
return a value");
|
||||
fcx.ccx.tcx.sess.span_err(f.decl.output.span,
|
||||
fcx.ccx.tcx.sess.span_fatal(f.decl.output.span,
|
||||
"see declared return type of '" +
|
||||
ty_to_str(*f.decl.output) + "'");
|
||||
} else if (f.decl.cf == noreturn) {
|
||||
@ -162,7 +162,7 @@ fn check_states_against_conditions(&fn_ctxt fcx, &_fn f, &ann a,
|
||||
// the fcx.id bit means "returns" for a returning fn,
|
||||
// "diverges" for a non-returning fn
|
||||
if (!promises(fcx, post, ret_c)) {
|
||||
fcx.ccx.tcx.sess.span_err(f.body.span,
|
||||
fcx.ccx.tcx.sess.span_fatal(f.body.span,
|
||||
"In non-returning function " + fcx.name
|
||||
+
|
||||
", some control paths may \
|
||||
|
@ -1679,7 +1679,7 @@ fn field_num(&session::session sess, &span sp, &ast::ident id) -> uint {
|
||||
for (u8 c in id) {
|
||||
if (i == 0u) {
|
||||
if (c != '_' as u8) {
|
||||
sess.span_err(sp,
|
||||
sess.span_fatal(sp,
|
||||
"bad numeric field on tuple: " +
|
||||
"missing leading underscore");
|
||||
}
|
||||
@ -1690,7 +1690,7 @@ fn field_num(&session::session sess, &span sp, &ast::ident id) -> uint {
|
||||
} else {
|
||||
auto s = "";
|
||||
s += str::unsafe_from_byte(c);
|
||||
sess.span_err(sp,
|
||||
sess.span_fatal(sp,
|
||||
"bad numeric field on tuple: " +
|
||||
" non-digit character: " + s);
|
||||
}
|
||||
@ -1704,14 +1704,14 @@ fn field_idx(&session::session sess, &span sp, &ast::ident id,
|
||||
&vec[field] fields) -> uint {
|
||||
let uint i = 0u;
|
||||
for (field f in fields) { if (str::eq(f.ident, id)) { ret i; } i += 1u; }
|
||||
sess.span_err(sp, "unknown field '" + id + "' of record");
|
||||
sess.span_fatal(sp, "unknown field '" + id + "' of record");
|
||||
}
|
||||
|
||||
fn method_idx(&session::session sess, &span sp, &ast::ident id,
|
||||
&vec[method] meths) -> uint {
|
||||
let uint i = 0u;
|
||||
for (method m in meths) { if (str::eq(m.ident, id)) { ret i; } i += 1u; }
|
||||
sess.span_err(sp, "unknown method '" + id + "' of obj");
|
||||
sess.span_fatal(sp, "unknown method '" + id + "' of obj");
|
||||
}
|
||||
|
||||
fn sort_methods(&vec[method] meths) -> vec[method] {
|
||||
|
@ -114,7 +114,7 @@ fn ty_param_count_and_ty_for_def(&@fn_ctxt fcx, &span sp, &ast::def defn) ->
|
||||
ret tup(0u, ty::mk_nil(fcx.ccx.tcx));
|
||||
}
|
||||
case (ast::def_ty(_)) {
|
||||
fcx.ccx.tcx.sess.span_err(sp, "expected value but found type");
|
||||
fcx.ccx.tcx.sess.span_fatal(sp, "expected value but found type");
|
||||
}
|
||||
case (_) {
|
||||
// FIXME: handle other names.
|
||||
@ -152,7 +152,7 @@ fn instantiate_path(&@fn_ctxt fcx, &ast::path pth, &ty_param_count_and_ty tpt,
|
||||
}
|
||||
ty_substs_opt = some[vec[ty::t]](ty_substs);
|
||||
if (ty_param_count == 0u) {
|
||||
fcx.ccx.tcx.sess.span_err(sp,
|
||||
fcx.ccx.tcx.sess.span_fatal(sp,
|
||||
"this item does not take type " +
|
||||
"parameters");
|
||||
fail;
|
||||
@ -188,7 +188,7 @@ fn structurally_resolved_type(&@fn_ctxt fcx, &span sp, ty::t typ) -> ty::t {
|
||||
alt (r) {
|
||||
case (fix_ok(?typ_s)) { ret typ_s; }
|
||||
case (fix_err(_)) {
|
||||
fcx.ccx.tcx.sess.span_err(sp,
|
||||
fcx.ccx.tcx.sess.span_fatal(sp,
|
||||
"the type of this value must be " +
|
||||
"known in this context");
|
||||
}
|
||||
@ -219,7 +219,7 @@ fn ast_ty_to_ty(&ty::ctxt tcx, &ty_getter getter, &@ast::ty ast_ty) -> ty::t {
|
||||
alt (tcx.ast_ty_to_ty_cache.find(ast_ty)) {
|
||||
case (some[option::t[ty::t]](some[ty::t](?ty))) { ret ty; }
|
||||
case (some[option::t[ty::t]](none)) {
|
||||
tcx.sess.span_err(ast_ty.span,
|
||||
tcx.sess.span_fatal(ast_ty.span,
|
||||
"illegal recursive type " +
|
||||
"(insert a tag in the cycle, " +
|
||||
"if this is desired)");
|
||||
@ -252,7 +252,7 @@ fn ast_ty_to_ty(&ty::ctxt tcx, &ty_getter getter, &@ast::ty ast_ty) -> ty::t {
|
||||
}
|
||||
if (vec::len(param_bindings) !=
|
||||
ty::count_ty_params(tcx, params_opt_and_ty._1)) {
|
||||
tcx.sess.span_err(sp,
|
||||
tcx.sess.span_fatal(sp,
|
||||
"Wrong number of type arguments for a" +
|
||||
" polymorphic tag");
|
||||
}
|
||||
@ -333,7 +333,7 @@ fn ast_ty_to_ty(&ty::ctxt tcx, &ty_getter getter, &@ast::ty ast_ty) -> ty::t {
|
||||
}
|
||||
case (ast::def_ty_arg(?id)) { typ = ty::mk_param(tcx, id); }
|
||||
case (_) {
|
||||
tcx.sess.span_err(ast_ty.span,
|
||||
tcx.sess.span_fatal(ast_ty.span,
|
||||
"found type name used as a variable");
|
||||
}
|
||||
}
|
||||
@ -508,7 +508,7 @@ mod collect {
|
||||
if (ty::type_has_dynamic_size(cx.tcx, tt)) {
|
||||
alt (ty_mode) {
|
||||
case (mo_val) {
|
||||
cx.tcx.sess.span_err(a.ty.span,
|
||||
cx.tcx.sess.span_fatal(a.ty.span,
|
||||
"Dynamically sized arguments \
|
||||
must be passed by alias");
|
||||
}
|
||||
@ -916,7 +916,7 @@ mod demand {
|
||||
case (ures_err(?err)) {
|
||||
auto e_err = resolve_type_vars_if_possible(fcx, expected_1);
|
||||
auto a_err = resolve_type_vars_if_possible(fcx, actual_1);
|
||||
fcx.ccx.tcx.sess.span_err(sp,
|
||||
fcx.ccx.tcx.sess.span_fatal(sp,
|
||||
"mismatched types: expected " +
|
||||
ty_to_str(fcx.ccx.tcx, e_err) +
|
||||
" but found " +
|
||||
@ -982,7 +982,7 @@ mod writeback {
|
||||
alt (ty::unify::fixup_vars(fcx.ccx.tcx, fcx.var_bindings, typ)) {
|
||||
case (fix_ok(?new_type)) { ret new_type; }
|
||||
case (fix_err(?vid)) {
|
||||
fcx.ccx.tcx.sess.span_err(sp,
|
||||
fcx.ccx.tcx.sess.span_fatal(sp,
|
||||
"cannot determine a type \
|
||||
for this expression");
|
||||
}
|
||||
@ -1026,7 +1026,7 @@ mod writeback {
|
||||
write::ty_only(fcx.ccx.tcx, l.node.ann.id, lty);
|
||||
}
|
||||
case (fix_err(_)) {
|
||||
fcx.ccx.tcx.sess.span_err(l.span,
|
||||
fcx.ccx.tcx.sess.span_fatal(l.span,
|
||||
"cannot determine a type \
|
||||
for this local variable");
|
||||
}
|
||||
@ -1232,7 +1232,7 @@ fn check_pat(&@fn_ctxt fcx, &@ast::pat pat, ty::t expected) {
|
||||
// FIXME: Switch expected and actual in this message? I
|
||||
// can never tell.
|
||||
|
||||
fcx.ccx.tcx.sess.span_err(pat.span,
|
||||
fcx.ccx.tcx.sess.span_fatal(pat.span,
|
||||
#fmt("mismatched types: \
|
||||
expected tag, found %s",
|
||||
ty_to_str(fcx.ccx.tcx,
|
||||
@ -1271,7 +1271,7 @@ fn check_pat(&@fn_ctxt fcx, &@ast::pat pat, ty::t expected) {
|
||||
if (arg_len == 1u) {
|
||||
""
|
||||
} else { "s" });
|
||||
fcx.ccx.tcx.sess.span_err(pat.span, s);
|
||||
fcx.ccx.tcx.sess.span_fatal(pat.span, s);
|
||||
}
|
||||
// TODO: vec::iter2
|
||||
|
||||
@ -1285,7 +1285,7 @@ fn check_pat(&@fn_ctxt fcx, &@ast::pat pat, ty::t expected) {
|
||||
// TODO (issue #448): Wrap a #fmt string over multiple
|
||||
// lines...
|
||||
|
||||
fcx.ccx.tcx.sess.span_err(pat.span,
|
||||
fcx.ccx.tcx.sess.span_fatal(pat.span,
|
||||
#fmt("this pattern has %u field%s, \
|
||||
but the corresponding \
|
||||
variant has no fields",
|
||||
@ -1303,7 +1303,7 @@ fn require_impure(&session::session sess, &ast::purity f_purity, &span sp) {
|
||||
alt (f_purity) {
|
||||
case (ast::impure_fn) { ret; }
|
||||
case (ast::pure_fn) {
|
||||
sess.span_err(sp,
|
||||
sess.span_fatal(sp,
|
||||
"Found impure expression in pure function decl");
|
||||
}
|
||||
}
|
||||
@ -1328,14 +1328,14 @@ fn require_pure_call(@crate_ctxt ccx, &ast::purity caller_purity,
|
||||
alt (get_function_purity(ccx, d_id)) {
|
||||
case (ast::pure_fn) { ret; }
|
||||
case (_) {
|
||||
ccx.tcx.sess.span_err(sp,
|
||||
ccx.tcx.sess.span_fatal(sp,
|
||||
"Pure function calls \
|
||||
impure function");
|
||||
}
|
||||
}
|
||||
}
|
||||
case (_) {
|
||||
ccx.tcx.sess.span_err(sp,
|
||||
ccx.tcx.sess.span_fatal(sp,
|
||||
"Pure function calls \
|
||||
unknown function");
|
||||
}
|
||||
@ -1347,7 +1347,7 @@ fn require_pure_call(@crate_ctxt ccx, &ast::purity caller_purity,
|
||||
fn require_pure_function(@crate_ctxt ccx, &ast::def_id d_id, &span sp) {
|
||||
alt (get_function_purity(ccx, d_id)) {
|
||||
case (ast::impure_fn) {
|
||||
ccx.tcx.sess.span_err(sp,
|
||||
ccx.tcx.sess.span_fatal(sp,
|
||||
"Found non-predicate in check expression");
|
||||
}
|
||||
case (_) { ret; }
|
||||
@ -1376,7 +1376,7 @@ fn check_expr(&@fn_ctxt fcx, &@ast::expr expr) {
|
||||
case (ty::ty_fn(_, ?arg_tys_0, _, _, _)) { arg_tys = arg_tys_0; }
|
||||
case (ty::ty_native_fn(_, ?arg_tys_0, _)) { arg_tys = arg_tys_0; }
|
||||
case (_) {
|
||||
fcx.ccx.tcx.sess.span_err(f.span,
|
||||
fcx.ccx.tcx.sess.span_fatal(f.span,
|
||||
"mismatched types: \
|
||||
expected function or native \
|
||||
function but found "
|
||||
@ -1388,7 +1388,7 @@ fn check_expr(&@fn_ctxt fcx, &@ast::expr expr) {
|
||||
auto expected_arg_count = vec::len[ty::arg](arg_tys);
|
||||
auto supplied_arg_count = vec::len[option::t[@ast::expr]](args);
|
||||
if (expected_arg_count != supplied_arg_count) {
|
||||
fcx.ccx.tcx.sess.span_err(sp,
|
||||
fcx.ccx.tcx.sess.span_fatal(sp,
|
||||
#fmt("this function takes %u \
|
||||
parameter%s but %u parameter%s \
|
||||
supplied",
|
||||
@ -1474,7 +1474,7 @@ fn check_expr(&@fn_ctxt fcx, &@ast::expr expr) {
|
||||
if (!ast::is_constraint_arg(operand)) {
|
||||
auto s = "Constraint args must be \
|
||||
slot variables or literals";
|
||||
fcx.ccx.tcx.sess.span_err(e.span, s);
|
||||
fcx.ccx.tcx.sess.span_fatal(e.span, s);
|
||||
}
|
||||
}
|
||||
require_pure_function(fcx.ccx, d_id, e.span);
|
||||
@ -1482,12 +1482,12 @@ fn check_expr(&@fn_ctxt fcx, &@ast::expr expr) {
|
||||
case (_) {
|
||||
auto s = "In a constraint, expected the \
|
||||
constraint name to be an explicit name";
|
||||
fcx.ccx.tcx.sess.span_err(e.span,s);
|
||||
fcx.ccx.tcx.sess.span_fatal(e.span,s);
|
||||
}
|
||||
}
|
||||
}
|
||||
case (_) {
|
||||
fcx.ccx.tcx.sess.span_err(e.span,
|
||||
fcx.ccx.tcx.sess.span_fatal(e.span,
|
||||
"check on non-predicate");
|
||||
}
|
||||
}
|
||||
@ -1555,7 +1555,7 @@ fn check_expr(&@fn_ctxt fcx, &@ast::expr expr) {
|
||||
case (_) {
|
||||
auto s = "dereferencing non-box type: " +
|
||||
ty_to_str(fcx.ccx.tcx, oper_t);
|
||||
fcx.ccx.tcx.sess.span_err(expr.span, s);
|
||||
fcx.ccx.tcx.sess.span_fatal(expr.span, s);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1563,7 +1563,7 @@ fn check_expr(&@fn_ctxt fcx, &@ast::expr expr) {
|
||||
if (!type_is_integral(fcx, oper.span, oper_t) &&
|
||||
structure_of(fcx, oper.span, oper_t) !=
|
||||
ty::ty_bool) {
|
||||
fcx.ccx.tcx.sess.span_err(expr.span,
|
||||
fcx.ccx.tcx.sess.span_fatal(expr.span,
|
||||
#fmt("mismatched types: \
|
||||
expected bool or \
|
||||
integer but found %s",
|
||||
@ -1588,7 +1588,7 @@ fn check_expr(&@fn_ctxt fcx, &@ast::expr expr) {
|
||||
// supplied some, that's an error.
|
||||
|
||||
if (vec::len[@ast::ty](pth.node.types) > 0u) {
|
||||
fcx.ccx.tcx.sess.span_err(expr.span,
|
||||
fcx.ccx.tcx.sess.span_fatal(expr.span,
|
||||
"this kind of value does not \
|
||||
take type parameters");
|
||||
}
|
||||
@ -1607,7 +1607,7 @@ fn check_expr(&@fn_ctxt fcx, &@ast::expr expr) {
|
||||
case (none) {
|
||||
auto nil = ty::mk_nil(fcx.ccx.tcx);
|
||||
if (!are_compatible(fcx, fcx.ret_ty, nil)) {
|
||||
fcx.ccx.tcx.sess.span_err(expr.span,
|
||||
fcx.ccx.tcx.sess.span_fatal(expr.span,
|
||||
"ret; in function \
|
||||
returning non-nil");
|
||||
}
|
||||
@ -1627,7 +1627,7 @@ fn check_expr(&@fn_ctxt fcx, &@ast::expr expr) {
|
||||
case (none) {
|
||||
auto nil = ty::mk_nil(fcx.ccx.tcx);
|
||||
if (!are_compatible(fcx, fcx.ret_ty, nil)) {
|
||||
fcx.ccx.tcx.sess.span_err(expr.span,
|
||||
fcx.ccx.tcx.sess.span_fatal(expr.span,
|
||||
"put; in iterator \
|
||||
yielding non-nil");
|
||||
}
|
||||
@ -1696,7 +1696,7 @@ fn check_expr(&@fn_ctxt fcx, &@ast::expr expr) {
|
||||
but found %s",
|
||||
ty_to_str(fcx.ccx.tcx,
|
||||
lhs_t));
|
||||
fcx.ccx.tcx.sess.span_err(expr.span,s);
|
||||
fcx.ccx.tcx.sess.span_fatal(expr.span,s);
|
||||
}
|
||||
}
|
||||
write::ty_only_fixup(fcx, a.id, chan_t);
|
||||
@ -1726,7 +1726,7 @@ fn check_expr(&@fn_ctxt fcx, &@ast::expr expr) {
|
||||
elt_ty = ty::mk_mach(fcx.ccx.tcx, util::common::ty_u8);
|
||||
}
|
||||
case (_) {
|
||||
fcx.ccx.tcx.sess.span_err(expr.span,
|
||||
fcx.ccx.tcx.sess.span_fatal(expr.span,
|
||||
"type of for loop iterator \
|
||||
is not a vector or string");
|
||||
}
|
||||
@ -1916,7 +1916,7 @@ fn check_expr(&@fn_ctxt fcx, &@ast::expr expr) {
|
||||
|
||||
if (!(type_is_scalar(fcx, expr.span, expr_ty(fcx.ccx.tcx, e)) &&
|
||||
type_is_scalar(fcx, expr.span, t_1))) {
|
||||
fcx.ccx.tcx.sess.span_err(expr.span,
|
||||
fcx.ccx.tcx.sess.span_fatal(expr.span,
|
||||
"non-scalar cast: " +
|
||||
ty_to_str(fcx.ccx.tcx,
|
||||
expr_ty(fcx.ccx.tcx,
|
||||
@ -1984,7 +1984,7 @@ fn check_expr(&@fn_ctxt fcx, &@ast::expr expr) {
|
||||
alt (structure_of(fcx, expr.span, bexpr_t)) {
|
||||
case (ty::ty_rec(?flds)) { base_fields = flds; }
|
||||
case (_) {
|
||||
fcx.ccx.tcx.sess.span_err(expr.span,
|
||||
fcx.ccx.tcx.sess.span_fatal(expr.span,
|
||||
"record update \
|
||||
non-record base");
|
||||
}
|
||||
@ -2000,7 +2000,7 @@ fn check_expr(&@fn_ctxt fcx, &@ast::expr expr) {
|
||||
}
|
||||
}
|
||||
if (!found) {
|
||||
fcx.ccx.tcx.sess.span_err(expr.span,
|
||||
fcx.ccx.tcx.sess.span_fatal(expr.span,
|
||||
"unknown field in \
|
||||
record update: "
|
||||
+ f.ident);
|
||||
@ -2018,7 +2018,7 @@ fn check_expr(&@fn_ctxt fcx, &@ast::expr expr) {
|
||||
let uint ix =
|
||||
ty::field_num(fcx.ccx.tcx.sess, expr.span, field);
|
||||
if (ix >= vec::len[ty::mt](args)) {
|
||||
fcx.ccx.tcx.sess.span_err(expr.span,
|
||||
fcx.ccx.tcx.sess.span_fatal(expr.span,
|
||||
"bad index on tuple");
|
||||
}
|
||||
write::ty_only_fixup(fcx, a.id, args.(ix).ty);
|
||||
@ -2028,7 +2028,7 @@ fn check_expr(&@fn_ctxt fcx, &@ast::expr expr) {
|
||||
ty::field_idx(fcx.ccx.tcx.sess, expr.span, field,
|
||||
fields);
|
||||
if (ix >= vec::len[ty::field](fields)) {
|
||||
fcx.ccx.tcx.sess.span_err(expr.span,
|
||||
fcx.ccx.tcx.sess.span_fatal(expr.span,
|
||||
"bad index on record");
|
||||
}
|
||||
write::ty_only_fixup(fcx, a.id, fields.(ix).mt.ty);
|
||||
@ -2038,7 +2038,7 @@ fn check_expr(&@fn_ctxt fcx, &@ast::expr expr) {
|
||||
ty::method_idx(fcx.ccx.tcx.sess, expr.span, field,
|
||||
methods);
|
||||
if (ix >= vec::len[ty::method](methods)) {
|
||||
fcx.ccx.tcx.sess.span_err(expr.span,
|
||||
fcx.ccx.tcx.sess.span_fatal(expr.span,
|
||||
"bad index on obj");
|
||||
}
|
||||
auto meth = methods.(ix);
|
||||
@ -2063,7 +2063,7 @@ fn check_expr(&@fn_ctxt fcx, &@ast::expr expr) {
|
||||
check_expr(fcx, idx);
|
||||
auto idx_t = expr_ty(fcx.ccx.tcx, idx);
|
||||
if (!type_is_integral(fcx, idx.span, idx_t)) {
|
||||
fcx.ccx.tcx.sess.span_err(idx.span,
|
||||
fcx.ccx.tcx.sess.span_fatal(idx.span,
|
||||
"mismatched types: expected \
|
||||
integer but found "
|
||||
+ ty_to_str(fcx.ccx.tcx, idx_t));
|
||||
@ -2084,7 +2084,7 @@ fn check_expr(&@fn_ctxt fcx, &@ast::expr expr) {
|
||||
write::ty_only_fixup(fcx, a.id, typ);
|
||||
}
|
||||
case (_) {
|
||||
fcx.ccx.tcx.sess.span_err(expr.span,
|
||||
fcx.ccx.tcx.sess.span_fatal(expr.span,
|
||||
"vector-indexing bad type: " +
|
||||
ty_to_str(fcx.ccx.tcx,
|
||||
base_t));
|
||||
@ -2105,7 +2105,7 @@ fn check_expr(&@fn_ctxt fcx, &@ast::expr expr) {
|
||||
write::ty_only_fixup(fcx, a.id, ct);
|
||||
}
|
||||
case (_) {
|
||||
fcx.ccx.tcx.sess.span_err(expr.span,
|
||||
fcx.ccx.tcx.sess.span_fatal(expr.span,
|
||||
"bad port type: " +
|
||||
ty_to_str(fcx.ccx.tcx,
|
||||
port_t));
|
||||
@ -2218,7 +2218,7 @@ fn ast_constr_to_constr(ty::ctxt tcx, &@ast::constr c)
|
||||
id=pred_id));
|
||||
}
|
||||
case (_) {
|
||||
tcx.sess.span_err(c.span, "Predicate "
|
||||
tcx.sess.span_fatal(c.span, "Predicate "
|
||||
+ path_to_str(c.node.path)
|
||||
+ " is unbound or bound to a non-function");
|
||||
}
|
||||
@ -2339,7 +2339,7 @@ fn check_fn(&@crate_ctxt ccx, &ast::fn_decl decl, ast::proto proto,
|
||||
// per the previous comment, this just checks that the declared
|
||||
// type is bool, and trusts that that's the actual return type.
|
||||
if (!ty::type_is_bool(ccx.tcx, fcx.ret_ty)) {
|
||||
ccx.tcx.sess.span_err(body.span,
|
||||
ccx.tcx.sess.span_fatal(body.span,
|
||||
"Non-boolean return type in pred");
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user