Skip to content

Commit ce7b803

Browse files
committed
Minor capitalization/punctuation fixes in error messages
1 parent 46809f7 commit ce7b803

File tree

5 files changed

+21
-20
lines changed

5 files changed

+21
-20
lines changed

src/rustc/middle/typeck/check.rs

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -385,7 +385,7 @@ fn check_item(ccx: @crate_ctxt, it: @ast::item) {
385385
// Check that there's at least one field
386386
let (fields,_) = split_class_items(members);
387387
if fields.len() < 1u {
388-
ccx.tcx.sess.span_err(it.span, "A class must have at least one \
388+
ccx.tcx.sess.span_err(it.span, "a class must have at least one \
389389
field");
390390
}
391391
// Check that the class is instantiable
@@ -942,7 +942,7 @@ fn check_expr_with_unifier(fcx: @fn_ctxt,
942942
// separate case below.
943943
tcx.sess.span_bug(
944944
expr.span,
945-
#fmt["Comparison operator in expr_binop: %s",
945+
#fmt["comparison operator in expr_binop: %s",
946946
ast_util::binop_to_str(op)]);
947947
}
948948
_ { lhs_t }
@@ -1221,7 +1221,7 @@ fn check_expr_with_unifier(fcx: @fn_ctxt,
12211221
result::ok(_) { /* fall through */ }
12221222
result::err(_) {
12231223
tcx.sess.span_err(expr.span,
1224-
"ret; in function returning non-nil"); }
1224+
"`ret;` in function returning non-nil"); }
12251225
}
12261226
}
12271227
some(e) { check_expr_with(fcx, e, ret_ty); }
@@ -1303,16 +1303,17 @@ fn check_expr_with_unifier(fcx: @fn_ctxt,
13031303
result::ok(_) {}
13041304
result::err(err) {
13051305
tcx.sess.span_fatal(
1306-
expr.span, #fmt("a loop function's last argument \
1306+
expr.span, #fmt("a `loop` function's last argument \
13071307
should return `bool`, not `%s`",
13081308
fcx.infcx.ty_to_str(fty.output)));
13091309
}
13101310
}
13111311
(ty::mk_fn(tcx, {output: ty::mk_nil(tcx) with fty}), fty.proto)
13121312
}
13131313
_ {
1314-
tcx.sess.span_fatal(expr.span, "a loop function's last argument \
1315-
should be of function type");
1314+
tcx.sess.span_fatal(expr.span, "a `loop` function's last \
1315+
argument should be of function \
1316+
type");
13161317
}
13171318
};
13181319
alt check b.node {
@@ -1338,7 +1339,7 @@ fn check_expr_with_unifier(fcx: @fn_ctxt,
13381339
(ty::mk_fn(tcx, fty), fty.proto)
13391340
}
13401341
_ {
1341-
tcx.sess.span_fatal(expr.span, "a do function's last argument \
1342+
tcx.sess.span_fatal(expr.span, "a `do` function's last argument \
13421343
should be of function type");
13431344
}
13441345
};
@@ -1786,8 +1787,8 @@ fn check_instantiable(tcx: ty::ctxt,
17861787
let rty = ty::node_id_to_type(tcx, item_id);
17871788
if !ty::is_instantiable(tcx, rty) {
17881789
tcx.sess.span_err(sp, #fmt["this type cannot be instantiated \
1789-
without an instance of itself. \
1790-
Consider using option<%s>.",
1790+
without an instance of itself; \
1791+
consider using `option<%s>`",
17911792
ty_to_str(tcx, rty)]);
17921793
}
17931794
}
@@ -1826,7 +1827,7 @@ fn check_enum_variants(ccx: @crate_ctxt,
18261827
}
18271828
if vec::contains(disr_vals, disr_val) {
18281829
ccx.tcx.sess.span_err(v.span,
1829-
"discriminator value already exists.");
1830+
"discriminator value already exists");
18301831
}
18311832
disr_vals += [disr_val];
18321833
let ctor_ty = ty::node_id_to_type(ccx.tcx, v.node.id);
@@ -1853,7 +1854,7 @@ fn check_enum_variants(ccx: @crate_ctxt,
18531854
_ { false }
18541855
}
18551856
}) {
1856-
ccx.tcx.sess.span_err(sp, "illegal recursive enum type. \
1857+
ccx.tcx.sess.span_err(sp, "illegal recursive enum type; \
18571858
wrap the inner value in a box to \
18581859
make it representable");
18591860
}
@@ -2200,13 +2201,13 @@ fn check_bounds_are_used(ccx: @crate_ctxt,
22002201
if !r_used {
22012202
ccx.tcx.sess.span_err(
22022203
span, "lifetime `self` unused inside \
2203-
reference-parameterized type.");
2204+
reference-parameterized type");
22042205
}
22052206

22062207
for tps_used.eachi { |i, b|
22072208
if !b {
22082209
ccx.tcx.sess.span_err(
2209-
span, #fmt["Type parameter %s is unused.", *tps[i].ident]);
2210+
span, #fmt["type parameter `%s` is unused", *tps[i].ident]);
22102211
}
22112212
}
22122213
}
@@ -2273,13 +2274,13 @@ fn check_intrinsic_type(ccx: @crate_ctxt, it: @ast::native_item) {
22732274
let i_n_tps = (*i_ty.bounds).len();
22742275
if i_n_tps != n_tps {
22752276
tcx.sess.span_err(it.span, #fmt("intrinsic has wrong number \
2276-
of type parameters. found %u, \
2277+
of type parameters: found %u, \
22772278
expected %u", i_n_tps, n_tps));
22782279
} else {
22792280
require_same_types(
22802281
tcx, none, it.span, i_ty.ty, fty,
2281-
{|| #fmt["intrinsic has wrong type. \
2282-
expected %s",
2282+
{|| #fmt["intrinsic has wrong type: \
2283+
expected `%s`",
22832284
ty_to_str(ccx.tcx, fty)]});
22842285
}
22852286
}

src/test/compile-fail/issue-1763.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// Issue #1763 - infer types correctly
22

3-
type actor<T> = { //! ERROR Type parameter T is unused.
3+
type actor<T> = { //! ERROR type parameter `T` is unused
44
unused: bool
55
};
66

src/test/compile-fail/issue-2509-a.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
class c { //! ERROR A class must have at least one field
1+
class c { //! ERROR a class must have at least one field
22
new() { }
33
}
44

src/test/compile-fail/ret-non-nil.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// error-pattern: ret; in function returning non-nil
1+
// error-pattern: `ret;` in function returning non-nil
22

33
fn f() { ret; }
44

src/test/compile-fail/vec-field.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// error-pattern:attempted access of field `some_field_name` on type `[int]`
1+
// error-pattern:attempted access of field `some_field_name` on type `[int]/~`
22
// issue #367
33

44
fn f() {

0 commit comments

Comments
 (0)