1
Fork 0

rustc: Lower case error messages

This commit is contained in:
Brian Anderson 2012-03-05 16:27:27 -08:00
parent 13a07ce1d4
commit 0ee96de4ee
56 changed files with 107 additions and 108 deletions

View file

@ -439,7 +439,7 @@ fn build_link_meta(sess: session, c: ast::crate, output: str,
{ {
let os = str::split_char(fs::basename(output), '.'); let os = str::split_char(fs::basename(output), '.');
if (vec::len(os) < 2u) { if (vec::len(os) < 2u) {
sess.fatal(#fmt("Output file name %s doesn't\ sess.fatal(#fmt("output file name %s doesn't\
appear to have an extension", output)); appear to have an extension", output));
} }
vec::pop(os); vec::pop(os);

View file

@ -309,12 +309,12 @@ fn build_target_config(sopts: @session::options,
demitter: diagnostic::emitter) -> @session::config { demitter: diagnostic::emitter) -> @session::config {
let os = alt get_os(sopts.target_triple) { let os = alt get_os(sopts.target_triple) {
some(os) { os } some(os) { os }
none { early_error(demitter, "Unknown operating system!") } none { early_error(demitter, "unknown operating system") }
}; };
let arch = alt get_arch(sopts.target_triple) { let arch = alt get_arch(sopts.target_triple) {
some(arch) { arch } some(arch) { arch }
none { early_error(demitter, none { early_error(demitter,
"Unknown architecture! " + sopts.target_triple) } "unknown architecture: " + sopts.target_triple) }
}; };
let (int_type, uint_type, float_type) = alt arch { let (int_type, uint_type, float_type) = alt arch {
session::arch_x86 {(ast::ty_i32, ast::ty_u32, ast::ty_f64)} session::arch_x86 {(ast::ty_i32, ast::ty_u32, ast::ty_f64)}
@ -607,7 +607,7 @@ fn build_output_filenames(ifile: str,
} }
if odir != none { if odir != none {
sess.warn("Ignoring --out-dir flag due to -o flag."); sess.warn("ignoring --out-dir flag due to -o flag.");
} }
} }
} }

View file

@ -93,9 +93,9 @@ fn run_compiler(args: [str], demitter: diagnostic::emitter) {
ret; ret;
} }
let ifile = alt vec::len(match.free) { let ifile = alt vec::len(match.free) {
0u { early_error(demitter, "No input filename given.") } 0u { early_error(demitter, "o input filename given") }
1u { match.free[0] } 1u { match.free[0] }
_ { early_error(demitter, "Multiple input filenames provided.") } _ { early_error(demitter, "multiple input filenames provided") }
}; };
let sopts = build_session_options(match, demitter); let sopts = build_session_options(match, demitter);

View file

@ -823,7 +823,7 @@ fn decode_side_tables(xcx: extended_decode_ctxt,
val_dsr.read_dict_res(xcx)); val_dsr.read_dict_res(xcx));
} else { } else {
xcx.dcx.tcx.sess.bug( xcx.dcx.tcx.sess.bug(
#fmt["Unknown tag found in side tables: %x", tag]); #fmt["unknown tag found in side tables: %x", tag]);
} }
} }

View file

@ -96,7 +96,7 @@ fn list_file_metadata(sess: session::session, path: str, out: io::writer) {
alt get_metadata_section(sess, path) { alt get_metadata_section(sess, path) {
option::some(bytes) { decoder::list_crate_metadata(bytes, out); } option::some(bytes) { decoder::list_crate_metadata(bytes, out); }
option::none { option::none {
out.write_str("Could not find metadata in " + path + ".\n"); out.write_str("could not find metadata in " + path + ".\n");
} }
} }
} }

View file

@ -40,7 +40,7 @@ fn check_capture_clause(tcx: ty::ctxt,
if !vec::any(*freevars, {|fv| fv.def == cap_def}) { if !vec::any(*freevars, {|fv| fv.def == cap_def}) {
tcx.sess.span_warn( tcx.sess.span_warn(
cap_item.span, cap_item.span,
#fmt("Captured variable '%s' not used in closure", #fmt("captured variable '%s' not used in closure",
cap_item.name)); cap_item.name));
} }
@ -48,7 +48,7 @@ fn check_capture_clause(tcx: ty::ctxt,
if !seen_defs.insert(cap_def_id, ()) { if !seen_defs.insert(cap_def_id, ()) {
tcx.sess.span_err( tcx.sess.span_err(
cap_item.span, cap_item.span,
#fmt("Variable '%s' captured more than once", #fmt("variable '%s' captured more than once",
cap_item.name)); cap_item.name));
} }
}; };
@ -58,7 +58,7 @@ fn check_capture_clause(tcx: ty::ctxt,
ast::def_upvar(_, _, _) { ast::def_upvar(_, _, _) {
tcx.sess.span_err( tcx.sess.span_err(
cap_item.span, cap_item.span,
#fmt("Upvars (like '%s') cannot be moved into a closure", #fmt("upvars (like '%s') cannot be moved into a closure",
cap_item.name)); cap_item.name));
} }
_ {} _ {}
@ -70,7 +70,7 @@ fn check_capture_clause(tcx: ty::ctxt,
let cap_item0 = vec::head(v); let cap_item0 = vec::head(v);
tcx.sess.span_err( tcx.sess.span_err(
cap_item0.span, cap_item0.span,
"Cannot capture values explicitly with a block closure"); "cannot capture values explicitly with a block closure");
} }
}; };

View file

@ -150,7 +150,7 @@ fn check_expr(e: @expr, cx: ctx, v: visit::vt<ctx>) {
let t = ty::expr_ty(cx.tcx, ex); let t = ty::expr_ty(cx.tcx, ex);
let ty_fields = alt ty::get(t).struct { let ty_fields = alt ty::get(t).struct {
ty::ty_rec(f) { f } ty::ty_rec(f) { f }
_ { cx.tcx.sess.span_bug(ex.span, "Bad expr type in record"); } _ { cx.tcx.sess.span_bug(ex.span, "bad expr type in record"); }
}; };
for tf in ty_fields { for tf in ty_fields {
if !vec::any(fields, {|f| f.node.ident == tf.ident}) && if !vec::any(fields, {|f| f.node.ident == tf.ident}) &&

View file

@ -98,7 +98,7 @@ fn expr_root(tcx: ty::ctxt, ex: @expr, autoderef: bool) ->
is_mutbl = mt.mutbl == m_mutbl; is_mutbl = mt.mutbl == m_mutbl;
ptr = true; ptr = true;
} }
_ { tcx.sess.span_bug(base.span, "Ill-typed base \ _ { tcx.sess.span_bug(base.span, "ill-typed base \
expression in deref"); } expression in deref"); }
} }
ds += [@{mutbl: is_mutbl, kind: unbox(ptr && is_mutbl), ds += [@{mutbl: is_mutbl, kind: unbox(ptr && is_mutbl),

View file

@ -329,7 +329,7 @@ fn map_crate(e: @env, c: @ast::crate) {
e.mod_map.get(ast::crate_node_id).glob_imports e.mod_map.get(ast::crate_node_id).glob_imports
+= [glob]; += [glob];
} }
_ { e.sess.span_bug(vi.span, "Unexpected scope in a \ _ { e.sess.span_bug(vi.span, "unexpected scope in a \
glob import"); } glob import"); }
} }
} }
@ -376,7 +376,7 @@ fn resolve_imports(e: env) {
resolve_import(e, local_def(node_id), name, *path, span, scopes); resolve_import(e, local_def(node_id), name, *path, span, scopes);
} }
resolved(_, _, _, _, _, _) | is_glob(_, _, _) { } resolved(_, _, _, _, _, _) | is_glob(_, _, _) { }
_ { e.sess.bug("Shouldn't see a resolving in resolve_imports"); } _ { e.sess.bug("shouldn't see a resolving in resolve_imports"); }
} }
}; };
e.used_imports.track = false; e.used_imports.track = false;
@ -658,7 +658,7 @@ fn visit_local_with_scope(e: @env, loc: @local, sc:scopes, v:vt<scopes>) {
// Declaration shadows a enum that's in scope. // Declaration shadows a enum that's in scope.
// That's an error. // That's an error.
e.sess.span_err(loc.span, e.sess.span_err(loc.span,
#fmt("Declaration of %s shadows a enum that's in scope", #fmt("declaration of `%s` shadows a enum that's in scope",
path_to_ident(an_ident))); path_to_ident(an_ident)));
} }
_ {} _ {}
@ -1324,7 +1324,7 @@ fn lookup_in_block(e: env, name: ident, sp: span, b: ast::blk_, pos: uint,
} }
} }
} }
_ { e.sess.span_bug(vi.span, "Unexpected view_item in block"); } _ { e.sess.span_bug(vi.span, "unexpected view_item in block"); }
} }
} }
ret none; ret none;

View file

@ -428,7 +428,7 @@ fn compile_submatch(bcx: block, m: match, vals: [ValueRef], f: mk_fail,
let tup_ty = node_id_type(bcx, pat_id); let tup_ty = node_id_type(bcx, pat_id);
let n_tup_elts = alt ty::get(tup_ty).struct { let n_tup_elts = alt ty::get(tup_ty).struct {
ty::ty_tup(elts) { elts.len() } ty::ty_tup(elts) { elts.len() }
_ { ccx.sess.bug("Non-tuple type in tuple pattern"); } _ { ccx.sess.bug("non-tuple type in tuple pattern"); }
}; };
let tup_vals = [], i = 0u; let tup_vals = [], i = 0u;
while i < n_tup_elts { while i < n_tup_elts {
@ -588,7 +588,7 @@ fn make_phi_bindings(bcx: block, map: [exit_node],
if bcx.ccx().maps.copy_map.contains_key(node_id) { if bcx.ccx().maps.copy_map.contains_key(node_id) {
let local = alt bcx.fcx.lllocals.find(node_id) { let local = alt bcx.fcx.lllocals.find(node_id) {
some(local_mem(x)) { x } some(local_mem(x)) { x }
_ { bcx.tcx().sess.bug("Someone \ _ { bcx.tcx().sess.bug("someone \
forgot to document an invariant in \ forgot to document an invariant in \
make_phi_bindings"); } make_phi_bindings"); }
}; };

View file

@ -1957,7 +1957,7 @@ fn trans_if(cx: block, cond: @ast::expr, thn: ast::blk,
trans_block(else_cx, blk, else_dest) trans_block(else_cx, blk, else_dest)
} }
// would be nice to have a constraint on ifs // would be nice to have a constraint on ifs
_ { cx.tcx().sess.bug("Strange alternative in if"); } _ { cx.tcx().sess.bug("strange alternative in if"); }
} }
} }
_ { else_cx } _ { else_cx }
@ -2119,7 +2119,7 @@ fn monomorphic_fn(ccx: crate_ctxt, fn_id: ast::def_id, substs: [ty::t],
ast_map::node_method(m, _, pt) { (pt, m.ident) } ast_map::node_method(m, _, pt) { (pt, m.ident) }
// We can't monomorphize native functions // We can't monomorphize native functions
ast_map::node_native_item(_, _) { ret none; } ast_map::node_native_item(_, _) { ret none; }
_ { fail "Unexpected node type"; } _ { fail "unexpected node type"; }
}; };
let pt = *pt + [path_name(ccx.names(name))]; let pt = *pt + [path_name(ccx.names(name))];
let s = mangle_exported_name(ccx, pt, mono_ty); let s = mangle_exported_name(ccx, pt, mono_ty);
@ -2614,10 +2614,10 @@ fn trans_cast(cx: block, e: @ast::expr, id: ast::node_id,
integral {int_cast(e_res.bcx, ll_t_out, integral {int_cast(e_res.bcx, ll_t_out,
val_ty(lldiscrim_a), lldiscrim_a, true)} val_ty(lldiscrim_a), lldiscrim_a, true)}
float {SIToFP(e_res.bcx, lldiscrim_a, ll_t_out)} float {SIToFP(e_res.bcx, lldiscrim_a, ll_t_out)}
_ { ccx.sess.bug("Translating unsupported cast.") } _ { ccx.sess.bug("translating unsupported cast.") }
} }
} }
_ { ccx.sess.bug("Translating unsupported cast.") } _ { ccx.sess.bug("translating unsupported cast.") }
}; };
ret store_in_dest(e_res.bcx, newval, dest); ret store_in_dest(e_res.bcx, newval, dest);
} }
@ -3139,7 +3139,7 @@ fn trans_expr(bcx: block, e: @ast::expr, dest: dest) -> block {
bcx, proto, decl, body, e.span, e.id, cap_clause, dest); bcx, proto, decl, body, e.span, e.id, cap_clause, dest);
} }
_ { _ {
fail "Type of fn block is not a function!"; fail "type of fn block is not a function!";
} }
} }
} }
@ -3993,7 +3993,7 @@ fn copy_args_to_allocas(fcx: fn_ctxt, bcx: block, args: [ast::arg],
let tcx = bcx.tcx(); let tcx = bcx.tcx();
let arg_n: uint = 0u, bcx = bcx; let arg_n: uint = 0u, bcx = bcx;
let epic_fail = fn@() -> ! { let epic_fail = fn@() -> ! {
tcx.sess.bug("Someone forgot\ tcx.sess.bug("someone forgot\
to document an invariant in copy_args_to_allocas!"); to document an invariant in copy_args_to_allocas!");
}; };
for arg in arg_tys { for arg in arg_tys {
@ -4306,7 +4306,7 @@ fn trans_const(cx: crate_ctxt, e: @ast::expr, id: ast::node_id) {
llvm::LLVMSetInitializer(g, v); llvm::LLVMSetInitializer(g, v);
llvm::LLVMSetGlobalConstant(g, True); llvm::LLVMSetGlobalConstant(g, True);
} }
_ { cx.sess.span_fatal(e.span, "Unbound const in trans_const"); } _ { cx.sess.span_bug(e.span, "unbound const in trans_const"); }
} }
} }
@ -4319,7 +4319,7 @@ fn trans_item(ccx: crate_ctxt, item: ast::item) {
let llfndecl = alt ccx.item_ids.find(item.id) { let llfndecl = alt ccx.item_ids.find(item.id) {
some(llfndecl) { llfndecl } some(llfndecl) { llfndecl }
_ { _ {
ccx.sess.span_fatal(item.span, ccx.sess.span_bug(item.span,
"unbound function item in trans_item"); "unbound function item in trans_item");
} }
}; };

View file

@ -325,7 +325,7 @@ fn store_environment(
bcx = base::copy_val(bcx, INIT, bound_data, val, ty); bcx = base::copy_val(bcx, INIT, bound_data, val, ty);
} }
env_copy(_, _, temporary) { env_copy(_, _, temporary) {
fail "Cannot capture temporary upvar"; fail "cannot capture temporary upvar";
} }
env_move(val, ty, kind) { env_move(val, ty, kind) {
let src = {bcx:bcx, val:val, kind:kind}; let src = {bcx:bcx, val:val, kind:kind};
@ -339,7 +339,7 @@ fn store_environment(
Store(bcx, addr, bound_data); Store(bcx, addr, bound_data);
} }
env_ref(_, _, temporary) { env_ref(_, _, temporary) {
fail "Cannot capture temporary upvar"; fail "cannot capture temporary upvar";
} }
} }
} }

View file

@ -55,7 +55,7 @@ fn trans_impl(ccx: crate_ctxt, path: path, name: ast::ident,
m_bounds, none, m.id, none); m_bounds, none, m.id, none);
} }
_ { _ {
ccx.sess.bug("Unbound id in trans_impl"); ccx.sess.bug("unbound id in trans_impl");
} }
} }
} }
@ -347,7 +347,7 @@ fn trans_impl_vtable(ccx: crate_ctxt, pt: path,
extra_tps, target) extra_tps, target)
} }
_ { _ {
ccx.sess.span_bug(it.span, "No matching method \ ccx.sess.span_bug(it.span, "no matching method \
in trans_impl_vtable"); in trans_impl_vtable");
} }
} }
@ -459,7 +459,7 @@ fn dict_id(tcx: ty::ctxt, origin: typeck::dict_origin) -> dict_id {
@{def: did, params: []} @{def: did, params: []}
} }
_ { _ {
tcx.sess.bug("Unexpected dict_param in dict_id"); tcx.sess.bug("unexpected dict_param in dict_id");
} }
} }
} }
@ -523,7 +523,7 @@ fn get_dict_ptrs(bcx: block, origin: typeck::dict_origin)
{bcx: bcx, ptrs: [get_vtable(ccx, did)]} {bcx: bcx, ptrs: [get_vtable(ccx, did)]}
} }
_ { _ {
bcx.tcx().sess.bug("Unexpected dict_param in get_dict_ptrs"); bcx.tcx().sess.bug("unexpected dict_param in get_dict_ptrs");
} }
} }
} }

View file

@ -596,7 +596,7 @@ fn expr_to_constr_arg(tcx: ty::ctxt, e: @expr) -> @constr_arg_use {
expr_lit(l) { ret @respan(e.span, carg_lit(l)); } expr_lit(l) { ret @respan(e.span, carg_lit(l)); }
_ { _ {
tcx.sess.span_fatal(e.span, tcx.sess.span_fatal(e.span,
"Arguments to constrained functions must be " + "arguments to constrained functions must be " +
"literals or local variables"); "literals or local variables");
} }
} }
@ -619,16 +619,13 @@ fn expr_to_constr(tcx: ty::ctxt, e: @expr) -> sp_constr {
exprs_to_constr_args(tcx, args))); exprs_to_constr_args(tcx, args)));
} }
_ { _ {
tcx.sess.span_fatal(operator.span, tcx.sess.span_bug(operator.span,
"Internal error: " + "ill-formed operator in predicate");
" ill-formed operator \
in predicate");
} }
} }
} }
_ { _ {
tcx.sess.span_fatal(e.span, tcx.sess.span_bug(e.span, "ill-formed predicate");
"Internal error: " + " ill-formed predicate");
} }
} }
} }
@ -656,7 +653,7 @@ fn substitute_arg(cx: ty::ctxt, actuals: [@expr], a: @constr_arg) ->
if i < num_actuals { if i < num_actuals {
ret expr_to_constr_arg(cx, actuals[i]); ret expr_to_constr_arg(cx, actuals[i]);
} else { } else {
cx.sess.span_fatal(a.span, "Constraint argument out of bounds"); cx.sess.span_fatal(a.span, "constraint argument out of bounds");
} }
} }
carg_base { ret @respan(a.span, carg_base); } carg_base { ret @respan(a.span, carg_base); }
@ -1029,7 +1026,7 @@ fn args_to_constr_args(tcx: ty::ctxt, args: [arg],
node: args[i].id}) node: args[i].id})
} else { } else {
tcx.sess.span_bug(a.span, tcx.sess.span_bug(a.span,
"Index out of bounds in \ "index out of bounds in \
constraint arg"); constraint arg");
} }
} }

View file

@ -51,12 +51,12 @@ fn check_states_expr(e: @expr, fcx: fn_ctxt, v: visit::vt<fn_ctxt>) {
let s = ""; let s = "";
let diff = first_difference_string(fcx, prec, pres); let diff = first_difference_string(fcx, prec, pres);
s += s +=
"Unsatisfied precondition constraint (for example, " + diff + "unsatisfied precondition constraint (for example, " + diff +
") for expression:\n"; ") for expression:\n";
s += syntax::print::pprust::expr_to_str(e); s += syntax::print::pprust::expr_to_str(e);
s += "\nPrecondition:\n"; s += "\nprecondition:\n";
s += tritv_to_str(fcx, prec); s += tritv_to_str(fcx, prec);
s += "\nPrestate:\n"; s += "\nprestate:\n";
s += tritv_to_str(fcx, pres); s += tritv_to_str(fcx, pres);
fcx.ccx.tcx.sess.span_fatal(e.span, s); fcx.ccx.tcx.sess.span_fatal(e.span, s);
} }
@ -81,12 +81,12 @@ fn check_states_stmt(s: @stmt, fcx: fn_ctxt, v: visit::vt<fn_ctxt>) {
let ss = ""; let ss = "";
let diff = first_difference_string(fcx, prec, pres); let diff = first_difference_string(fcx, prec, pres);
ss += ss +=
"Unsatisfied precondition constraint (for example, " + diff + "unsatisfied precondition constraint (for example, " + diff +
") for statement:\n"; ") for statement:\n";
ss += syntax::print::pprust::stmt_to_str(*s); ss += syntax::print::pprust::stmt_to_str(*s);
ss += "\nPrecondition:\n"; ss += "\nprecondition:\n";
ss += tritv_to_str(fcx, prec); ss += tritv_to_str(fcx, prec);
ss += "\nPrestate: \n"; ss += "\nprestate: \n";
ss += tritv_to_str(fcx, pres); ss += tritv_to_str(fcx, pres);
fcx.ccx.tcx.sess.span_fatal(s.span, ss); fcx.ccx.tcx.sess.span_fatal(s.span, ss);
} }
@ -115,7 +115,7 @@ fn check_states_against_conditions(fcx: fn_ctxt,
fcx.ccx.tcx, id))) && fcx.ccx.tcx, id))) &&
f_decl.cf == return_val { f_decl.cf == return_val {
fcx.ccx.tcx.sess.span_err(f_body.span, fcx.ccx.tcx.sess.span_err(f_body.span,
"In function " + fcx.name + "in function " + fcx.name +
", not all control paths \ ", not all control paths \
return a value"); return a value");
fcx.ccx.tcx.sess.span_fatal(f_decl.output.span, fcx.ccx.tcx.sess.span_fatal(f_decl.output.span,
@ -129,7 +129,7 @@ fn check_states_against_conditions(fcx: fn_ctxt,
if !promises(fcx, post, fcx.enclosing.i_diverge) { if !promises(fcx, post, fcx.enclosing.i_diverge) {
fcx.ccx.tcx.sess.span_fatal(f_body.span, fcx.ccx.tcx.sess.span_fatal(f_body.span,
"In non-returning function " + "in non-returning function " +
fcx.name + fcx.name +
", some control paths may \ ", some control paths may \
return to the caller"); return to the caller");

View file

@ -17,7 +17,7 @@ fn forbid_upvar(fcx: fn_ctxt, rhs_id: node_id, sp: span, t: oper_type) {
alt local_node_id_to_def(fcx, rhs_id) { alt local_node_id_to_def(fcx, rhs_id) {
some(def_upvar(_, _, _)) { some(def_upvar(_, _, _)) {
fcx.ccx.tcx.sess.span_err(sp, fcx.ccx.tcx.sess.span_err(sp,
"Tried to deinitialize a variable \ "tried to deinitialize a variable \
declared in a different scope"); declared in a different scope");
} }
_ { } _ { }

View file

@ -608,7 +608,7 @@ fn fold_ty(cx: ctxt, fld: fold_mode, ty_0: t) -> t {
ty = mk_constr(cx, fold_ty(cx, fld, subty), cs); ty = mk_constr(cx, fold_ty(cx, fld, subty), cs);
} }
_ { _ {
cx.sess.fatal("Unsupported sort of type in fold_ty"); cx.sess.bug("unsupported sort of type in fold_ty");
} }
} }
alt tb.o_def_id { alt tb.o_def_id {
@ -868,7 +868,7 @@ fn type_kind(cx: ctxt, ty: t) -> kind {
param_bounds_to_kind(cx.ty_param_bounds.get(did.node)) param_bounds_to_kind(cx.ty_param_bounds.get(did.node))
} }
ty_constr(t, _) { type_kind(cx, t) } ty_constr(t, _) { type_kind(cx, t) }
_ { cx.sess.bug("Bad type in type_kind"); } _ { cx.sess.bug("bad type in type_kind"); }
}; };
cx.kind_cache.insert(ty, result); cx.kind_cache.insert(ty, result);
@ -1408,11 +1408,11 @@ fn occurs_check_fails(tcx: ctxt, sp: option<span>, vid: int, rt: t) ->
// assertion later on that the type doesn't contain // assertion later on that the type doesn't contain
// variables, so in this case we have to be sure to die. // variables, so in this case we have to be sure to die.
tcx.sess.span_fatal tcx.sess.span_fatal
(s, "Type inference failed because I \ (s, "type inference failed because I \
could not find a type\n that's both of the form " could not find a type\n that's both of the form "
+ ty_to_str(tcx, mk_var(tcx, vid)) + + ty_to_str(tcx, mk_var(tcx, vid)) +
" and of the form " + ty_to_str(tcx, rt) + " and of the form " + ty_to_str(tcx, rt) +
". Such a type would have to be infinitely large."); " - such a type would have to be infinitely large.");
} }
_ { ret true; } _ { ret true; }
} }
@ -1533,7 +1533,7 @@ mod unify {
variance: variance) -> union_result { variance: variance) -> union_result {
let vb = alt cx.st { let vb = alt cx.st {
in_bindings(vb) { vb } in_bindings(vb) { vb }
_ { cx.tcx.sess.bug("Someone forgot to document an invariant \ _ { cx.tcx.sess.bug("someone forgot to document an invariant \
in union"); } in union"); }
}; };
ufind::grow(vb.sets, math::max(set_a, set_b) + 1u); ufind::grow(vb.sets, math::max(set_a, set_b) + 1u);
@ -2113,12 +2113,12 @@ fn type_err_to_str(err: type_err) -> str {
mode_to_str(a_mode); mode_to_str(a_mode);
} }
terr_constr_len(e_len, a_len) { terr_constr_len(e_len, a_len) {
ret "Expected a type with " + uint::str(e_len) + ret "expected a type with " + uint::str(e_len) +
" constraints, but found one with " + uint::str(a_len) + " constraints, but found one with " + uint::str(a_len) +
" constraints"; " constraints";
} }
terr_constr_mismatch(e_constr, a_constr) { terr_constr_mismatch(e_constr, a_constr) {
ret "Expected a type with constraint " + ty_constr_to_str(e_constr) + ret "expected a type with constraint " + ty_constr_to_str(e_constr) +
" but found one with constraint " + " but found one with constraint " +
ty_constr_to_str(a_constr); ty_constr_to_str(a_constr);
} }
@ -2438,7 +2438,7 @@ fn ast_constr_to_constr<T>(tcx: ctxt, c: @ast::constr_general<T>) ->
} }
_ { _ {
tcx.sess.span_fatal(c.span, tcx.sess.span_fatal(c.span,
"Predicate " + path_to_str(c.node.path) + "predicate " + path_to_str(c.node.path) +
" is unbound or bound to a non-function or an \ " is unbound or bound to a non-function or an \
impure function"); impure function");
} }

View file

@ -262,7 +262,7 @@ fn ast_ty_to_ty(tcx: ty::ctxt, mode: mode, &&ast_ty: @ast::ty) -> ty::t {
ty_of_native_item(tcx, mode, native_item) ty_of_native_item(tcx, mode, native_item)
} }
_ { _ {
tcx.sess.bug("Unexpected sort of item in ast_ty_to_ty"); tcx.sess.bug("unexpected sort of item in ast_ty_to_ty");
} }
} }
} }
@ -293,7 +293,7 @@ fn ast_ty_to_ty(tcx: ty::ctxt, mode: mode, &&ast_ty: @ast::ty) -> ty::t {
// The typedef is type-parametric. Do the type substitution. // The typedef is type-parametric. Do the type substitution.
let param_bindings: [ty::t] = []; let param_bindings: [ty::t] = [];
if vec::len(args) != vec::len(*ty_param_bounds_and_ty.bounds) { if vec::len(args) != vec::len(*ty_param_bounds_and_ty.bounds) {
tcx.sess.span_fatal(sp, "Wrong number of type arguments for a \ tcx.sess.span_fatal(sp, "wrong number of type arguments for a \
polymorphic type"); polymorphic type");
} }
for ast_ty: @ast::ty in args { for ast_ty: @ast::ty in args {
@ -1611,7 +1611,7 @@ fn require_impure(sess: session, f_purity: ast::purity, sp: span) {
ast::unsafe_fn { ret; } ast::unsafe_fn { ret; }
ast::impure_fn | ast::crust_fn { ret; } ast::impure_fn | ast::crust_fn { ret; }
ast::pure_fn { ast::pure_fn {
sess.span_err(sp, "Found impure expression in pure function decl"); sess.span_err(sp, "found impure expression in pure function decl");
} }
} }
} }
@ -1847,7 +1847,7 @@ fn lookup_field_ty(cx: ty::ctxt, items:[@ast::class_item],
ast::instance_var(declname, t, _, _) if declname == fieldname { ast::instance_var(declname, t, _, _) if declname == fieldname {
alt item.node.privacy { alt item.node.privacy {
ast::priv { ast::priv {
cx.sess.span_fatal(sp, "Accessed private field outside \ cx.sess.span_fatal(sp, "accessed private field outside \
its enclosing class"); its enclosing class");
} }
ast::pub { ast::pub {
@ -1858,7 +1858,7 @@ fn lookup_field_ty(cx: ty::ctxt, items:[@ast::class_item],
_ { /* do nothing */ } _ { /* do nothing */ }
} }
} }
cx.sess.span_fatal(sp, #fmt("Unbound field %s", fieldname)); cx.sess.span_fatal(sp, #fmt("unbound field %s", fieldname));
} }
fn check_expr_fn_with_unifier(fcx: @fn_ctxt, fn check_expr_fn_with_unifier(fcx: @fn_ctxt,
@ -2843,20 +2843,20 @@ fn check_pred_expr(fcx: @fn_ctxt, e: @ast::expr) -> bool {
} }
_ { _ {
fcx.ccx.tcx.sess.span_err(operator.span, fcx.ccx.tcx.sess.span_err(operator.span,
"Impure function as operator \ "impure function as operator \
in constraint"); in constraint");
} }
} }
for operand: @ast::expr in operands { for operand: @ast::expr in operands {
if !ast_util::is_constraint_arg(operand) { if !ast_util::is_constraint_arg(operand) {
let s = let s =
"Constraint args must be slot variables or literals"; "constraint args must be slot variables or literals";
fcx.ccx.tcx.sess.span_err(e.span, s); fcx.ccx.tcx.sess.span_err(e.span, s);
} }
} }
} }
_ { _ {
let s = "In a constraint, expected the \ let s = "in a constraint, expected the \
constraint name to be an explicit name"; constraint name to be an explicit name";
fcx.ccx.tcx.sess.span_err(e.span, s); fcx.ccx.tcx.sess.span_err(e.span, s);
} }

View file

@ -312,7 +312,7 @@ fn parse_ty_field(p: parser) -> ast::ty_field {
fn ident_index(p: parser, args: [ast::arg], i: ast::ident) -> uint { fn ident_index(p: parser, args: [ast::arg], i: ast::ident) -> uint {
let j = 0u; let j = 0u;
for a: ast::arg in args { if a.ident == i { ret j; } j += 1u; } for a: ast::arg in args { if a.ident == i { ret j; } j += 1u; }
p.fatal("Unbound variable " + i + " in constraint arg"); p.fatal("unbound variable `" + i + "` in constraint arg");
} }
fn parse_type_constr_arg(p: parser) -> @ast::ty_constr_arg { fn parse_type_constr_arg(p: parser) -> @ast::ty_constr_arg {
@ -918,7 +918,7 @@ fn parse_bottom_expr(p: parser) -> pexpr {
if /*check*/ast_util::is_call_expr(e) { if /*check*/ast_util::is_call_expr(e) {
hi = e.span.hi; hi = e.span.hi;
ex = ast::expr_be(e); ex = ast::expr_be(e);
} else { p.fatal("Non-call expression in tail call"); } } else { p.fatal("non-call expression in tail call"); }
} else if eat_word(p, "copy") { } else if eat_word(p, "copy") {
let e = parse_expr(p); let e = parse_expr(p);
ex = ast::expr_copy(e); ex = ast::expr_copy(e);
@ -2008,7 +2008,9 @@ fn parse_item_class(p: parser, attrs: [ast::attribute]) -> @ast::item {
/* /*
Is it strange for the parser to check this? Is it strange for the parser to check this?
*/ */
none { /* parse error */ fail "Class with no ctor"; } none {
p.fatal("class with no ctor");
}
} }
} }

View file

@ -1,4 +1,4 @@
// error-pattern: Unsatisfied precondition constraint (for example, init(i // error-pattern:unsatisfied precondition constraint (for example, init(i
fn main() { fn main() {
let i: int; let i: int;

View file

@ -1,4 +1,4 @@
// error-pattern:Tried to deinitialize a variable declared in a different // error-pattern:tried to deinitialize a variable declared in a different
fn force(f: fn()) { f(); } fn force(f: fn()) { f(); }
fn main() { fn main() {
let x = @{x: 17, y: 2}; let x = @{x: 17, y: 2};

View file

@ -1,4 +1,4 @@
// error-pattern: Unsatisfied precondition constraint // error-pattern:unsatisfied precondition constraint
fn force(f: fn()) { f(); } fn force(f: fn()) { f(); }
fn main() { let x: int; force(fn&() { log(error, x); }); } fn main() { let x: int; force(fn&() { log(error, x); }); }

View file

@ -1,4 +1,4 @@
// error-pattern:Unsatisfied precondition // error-pattern:unsatisfied precondition
fn foo() -> int { fn foo() -> int {
let x: int; let x: int;

View file

@ -1,4 +1,4 @@
// error-pattern:Unsatisfied precondition // error-pattern:unsatisfied precondition
fn foo() -> int { fn foo() -> int {
let x: int; let x: int;

View file

@ -1,4 +1,4 @@
// error-pattern:Variable 'x' captured more than once // error-pattern:variable 'x' captured more than once
fn main() { fn main() {
let x = 5; let x = 5;
let y = fn~[move x; copy x]() -> int { x }; let y = fn~[move x; copy x]() -> int { x };

View file

@ -1,4 +1,4 @@
// error-pattern:Variable 'x' captured more than once // error-pattern:variable 'x' captured more than once
fn main() { fn main() {
let x = 5; let x = 5;
let y = fn~[copy x, x]() -> int { x }; let y = fn~[copy x, x]() -> int { x };

View file

@ -1,4 +1,4 @@
// error-pattern:Variable 'x' captured more than once // error-pattern:variable 'x' captured more than once
fn main() { fn main() {
let x = 5; let x = 5;
let y = fn~[move x, x]() -> int { x }; let y = fn~[move x, x]() -> int { x };

View file

@ -1,4 +1,4 @@
// error-pattern:Upvars (like 'x') cannot be moved into a closure // error-pattern:upvars (like 'x') cannot be moved into a closure
fn main() { fn main() {
let x = 5; let x = 5;
let _y = fn~[move x]() -> int { let _y = fn~[move x]() -> int {

View file

@ -1,4 +1,4 @@
// error-pattern: Unsatisfied precondition constraint (for example, init(y // error-pattern:unsatisfied precondition constraint (for example, init(y
fn main() { fn main() {
let y: int = 42; let y: int = 42;

View file

@ -1,4 +1,4 @@
// error-pattern: Unsatisfied precondition constraint (for example, even(y // error-pattern:unsatisfied precondition constraint (for example, even(y
fn print_even(y: int) : even(y) { log(debug, y); } fn print_even(y: int) : even(y) { log(debug, y); }

View file

@ -1,4 +1,4 @@
// error-pattern:Unsatisfied precondition // error-pattern:unsatisfied precondition
fn main() { fn main() {
// Typestate should work even in a fn@. we should reject this program. // Typestate should work even in a fn@. we should reject this program.

View file

@ -1,4 +1,4 @@
// error-pattern:Unsatisfied precondition // error-pattern:unsatisfied precondition
fn main() { fn main() {
let j = fn@() -> int { let i: int; ret i; }(); let j = fn@() -> int { let i: int; ret i; }();

View file

@ -1,4 +1,4 @@
// error-pattern:Unsatisfied precondition constraint // error-pattern:unsatisfied precondition constraint
pure fn even(x: uint) -> bool { pure fn even(x: uint) -> bool {
if x < 2u { if x < 2u {
ret false; ret false;

View file

@ -1,4 +1,4 @@
// error-pattern: In non-returning function f, some control paths may return // error-pattern:in non-returning function f, some control paths may return
fn g() -> ! { fail; } fn g() -> ! { fail; }
fn f() -> ! { ret 42; g(); } fn f() -> ! { ret 42; g(); }
fn main() { } fn main() { }

View file

@ -1,3 +1,3 @@
// error-pattern: In non-returning function f, some control paths may return // error-pattern:in non-returning function f, some control paths may return
fn f() -> ! { ret 42; fail; } fn f() -> ! { ret 42; fail; }
fn main() { } fn main() { }

View file

@ -1,4 +1,4 @@
// error-pattern: Unsatisfied precondition constraint // error-pattern:unsatisfied precondition constraint
fn test(-foo: int) { assert (foo == 10); } fn test(-foo: int) { assert (foo == 10); }
fn main() { let x = 10; test(x); log(debug, x); } fn main() { let x = 10; test(x); log(debug, x); }

View file

@ -1,4 +1,4 @@
// error-pattern:Declaration of thpppt shadows // error-pattern:declaration of `thpppt` shadows
enum ack { thpppt, ffff, } enum ack { thpppt, ffff, }
fn main() { fn main() {

View file

@ -1,4 +1,4 @@
// error-pattern:Declaration of none shadows // error-pattern:declaration of `none` shadows
import option::*; import option::*;
fn main() { fn main() {

View file

@ -1,4 +1,4 @@
// error-pattern:Unsatisfied precondition constraint (for example, uint::le // error-pattern:unsatisfied precondition constraint (for example, uint::le
fn main() unsafe { fn main() unsafe {
fn foo(_a: uint, _b: uint) : uint::le(_a, _b) {} fn foo(_a: uint, _b: uint) : uint::le(_a, _b) {}

View file

@ -1,5 +1,5 @@
// -*- rust -*- // -*- rust -*-
// error-pattern: Impure function as operator // error-pattern:impure function as operator
fn f(q: int) -> bool { ret true; } fn f(q: int) -> bool { ret true; }

View file

@ -1,6 +1,6 @@
// -*- rust -*- // -*- rust -*-
// error-pattern: Constraint args must be // error-pattern:constraint args must be
pure fn f(q: int) -> bool { ret true; } pure fn f(q: int) -> bool { ret true; }

View file

@ -1,4 +1,4 @@
// error-pattern: Unsatisfied precondition constraint (for example, init(i // error-pattern:unsatisfied precondition constraint (for example, init(i
fn main() { fn main() {
let i: int; let i: int;

View file

@ -1,6 +1,6 @@
// -*- rust -*- // -*- rust -*-
// error-pattern: Unsatisfied precondition constraint (for example, lt(a, b) // error-pattern:unsatisfied precondition constraint (for example, lt(a, b)
fn f(a: int, b: int) : lt(a, b) { } fn f(a: int, b: int) : lt(a, b) { }

View file

@ -1,6 +1,6 @@
// -*- rust -*- // -*- rust -*-
// error-pattern: Unsatisfied precondition constraint (for example, lt(a, b) // error-pattern:unsatisfied precondition constraint (for example, lt(a, b)
fn f(a: int, b: int) : lt(a, b) { } fn f(a: int, b: int) : lt(a, b) { }

View file

@ -1,3 +1,3 @@
// error-pattern:Unsatisfied precondition // error-pattern:unsatisfied precondition
fn main() { let x = 3; let y; x <-> y; } fn main() { let x = 3; let y; x <-> y; }

View file

@ -1,4 +1,4 @@
// error-pattern: Wrong number of type arguments // error-pattern:wrong number of type arguments
enum quux<T> { bar } enum quux<T> { bar }

View file

@ -1,4 +1,4 @@
// error-pattern: Non-call expression in tail call // error-pattern:non-call expression in tail call
fn f() -> int { fn f() -> int {
let x = 1; let x = 1;

View file

@ -1,4 +1,4 @@
// error-pattern:Unsatisfied precondition constraint (for example, init(bar // error-pattern:unsatisfied precondition constraint (for example, init(bar
fn main() { fn main() {
let bar; let bar;
fn baz(x: int) { } fn baz(x: int) { }

View file

@ -1,2 +1,2 @@
// error-pattern: Unsatisfied precondition constraint (for example, init(x // error-pattern:unsatisfied precondition constraint (for example, init(x
fn main() { let x = @5; let y <- x; log(debug, *x); } fn main() { let x = @5; let y <- x; log(debug, *x); }

View file

@ -1,4 +1,4 @@
// error-pattern: Unsatisfied precondition constraint // error-pattern:unsatisfied precondition constraint
fn send<T: send>(ch: _chan<T>, -data: T) { fn send<T: send>(ch: _chan<T>, -data: T) {
log(debug, ch); log(debug, ch);
log(debug, data); log(debug, data);

View file

@ -1,4 +1,4 @@
// error-pattern:Unsatisfied precondition // error-pattern:unsatisfied precondition
fn foo(x: int) { log(debug, x); } fn foo(x: int) { log(debug, x); }

View file

@ -1,4 +1,4 @@
// error-pattern:Unsatisfied precondition // error-pattern:unsatisfied precondition
fn foo(x: int) { log(debug, x); } fn foo(x: int) { log(debug, x); }

View file

@ -1,4 +1,4 @@
// error-pattern:Unsatisfied precondition // error-pattern:unsatisfied precondition
fn foo(x: int) { log(debug, x); } fn foo(x: int) { log(debug, x); }

View file

@ -1,4 +1,4 @@
// error-pattern: Unsatisfied precondition constraint (for example, init(y // error-pattern:unsatisfied precondition constraint (for example, init(y
fn main() { fn main() {
let y: int = 42; let y: int = 42;

View file

@ -1,4 +1,4 @@
// error-pattern: Unsatisfied precondition constraint (for example, even(y // error-pattern:unsatisfied precondition constraint (for example, even(y
fn print_even(y: int) : even(y) { log(debug, y); } fn print_even(y: int) : even(y) { log(debug, y); }

View file

@ -1,4 +1,4 @@
// error-pattern: Unsatisfied precondition constraint // error-pattern:unsatisfied precondition constraint
fn test() { let w: [int]; w[5] = 0; } fn test() { let w: [int]; w[5] = 0; }