Skip to content

Commit a7849c4

Browse files
author
Lenny222
committed
make error messages conform to style guide
1 parent 9db698a commit a7849c4

File tree

149 files changed

+267
-267
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

149 files changed

+267
-267
lines changed

src/libextra/ebml.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,7 @@ pub mod reader {
305305
self.pos = r_doc.end;
306306
let str = r_doc.as_str_slice();
307307
if lbl != str {
308-
fail!("Expected label %s but found %s", lbl, str);
308+
fail!("Expected label %s, found %s", lbl, str);
309309
}
310310
}
311311
}
@@ -326,7 +326,7 @@ pub mod reader {
326326
r_doc.start,
327327
r_doc.end);
328328
if r_tag != (exp_tag as uint) {
329-
fail!("expected EBML doc with tag %? but found tag %?", exp_tag, r_tag);
329+
fail!("expected EBML doc with tag %?, found tag %?", exp_tag, r_tag);
330330
}
331331
if r_doc.end > self.parent.end {
332332
fail!("invalid EBML, child extends to 0x%x, parent to 0x%x",

src/libextra/terminfo/parser/compiled.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ pub fn parse(file: @Reader, longnames: bool) -> Result<~TermInfo, ~str> {
178178
// Check magic number
179179
let magic = file.read_le_u16();
180180
if (magic != 0x011A) {
181-
return Err(fmt!("invalid magic number: expected %x but found %x", 0x011A, magic as uint));
181+
return Err(fmt!("invalid magic number: expected %x, found %x", 0x011A, magic as uint));
182182
}
183183

184184
let names_bytes = file.read_le_i16() as int;
@@ -196,19 +196,19 @@ pub fn parse(file: @Reader, longnames: bool) -> Result<~TermInfo, ~str> {
196196
debug!("string_table_bytes = %?", string_table_bytes);
197197

198198
if (bools_bytes as uint) > boolnames.len() {
199-
error!("expected bools_bytes to be less than %? but found %?", boolnames.len(),
199+
error!("expected bools_bytes to be less than %?, found %?", boolnames.len(),
200200
bools_bytes);
201201
return Err(~"incompatible file: more booleans than expected");
202202
}
203203

204204
if (numbers_count as uint) > numnames.len() {
205-
error!("expected numbers_count to be less than %? but found %?", numnames.len(),
205+
error!("expected numbers_count to be less than %?, found %?", numnames.len(),
206206
numbers_count);
207207
return Err(~"incompatible file: more numbers than expected");
208208
}
209209

210210
if (string_offsets_count as uint) > stringnames.len() {
211-
error!("expected string_offsets_count to be less than %? but found %?", stringnames.len(),
211+
error!("expected string_offsets_count to be less than %?, found %?", stringnames.len(),
212212
string_offsets_count);
213213
return Err(~"incompatible file: more string offsets than expected");
214214
}

src/librustc/metadata/tydecode.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -542,12 +542,12 @@ pub fn parse_def_id(buf: &[u8]) -> ast::def_id {
542542

543543
let crate_num = match uint::parse_bytes(crate_part, 10u) {
544544
Some(cn) => cn as int,
545-
None => fail!("internal error: parse_def_id: crate number expected, but found %?",
545+
None => fail!("internal error: parse_def_id: crate number expected, found %?",
546546
crate_part)
547547
};
548548
let def_num = match uint::parse_bytes(def_part, 10u) {
549549
Some(dn) => dn as int,
550-
None => fail!("internal error: parse_def_id: id expected, but found %?",
550+
None => fail!("internal error: parse_def_id: id expected, found %?",
551551
def_part)
552552
};
553553
ast::def_id { crate: crate_num, node: def_num }

src/librustc/middle/trans/_match.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -413,7 +413,7 @@ pub fn assert_is_binding_or_wild(bcx: @mut Block, p: @ast::pat) {
413413
if !pat_is_binding_or_wild(bcx.tcx().def_map, p) {
414414
bcx.sess().span_bug(
415415
p.span,
416-
fmt!("Expected an identifier pattern but found p: %s",
416+
fmt!("Expected an identifier pattern, found p: %s",
417417
p.repr(bcx.tcx())));
418418
}
419419
}

src/librustc/middle/ty.rs

+28-28
Original file line numberDiff line numberDiff line change
@@ -3397,15 +3397,15 @@ pub fn type_err_to_str(cx: ctxt, err: &type_err) -> ~str {
33973397
match *err {
33983398
terr_mismatch => ~"types differ",
33993399
terr_purity_mismatch(values) => {
3400-
fmt!("expected %s fn but found %s fn",
3400+
fmt!("expected %s fn, found %s fn",
34013401
values.expected.to_str(), values.found.to_str())
34023402
}
34033403
terr_abi_mismatch(values) => {
3404-
fmt!("expected %s fn but found %s fn",
3404+
fmt!("expected %s fn, found %s fn",
34053405
values.expected.to_str(), values.found.to_str())
34063406
}
34073407
terr_onceness_mismatch(values) => {
3408-
fmt!("expected %s fn but found %s fn",
3408+
fmt!("expected %s fn, found %s fn",
34093409
values.expected.to_str(), values.found.to_str())
34103410
}
34113411
terr_sigil_mismatch(values) => {
@@ -3419,25 +3419,25 @@ pub fn type_err_to_str(cx: ctxt, err: &type_err) -> ~str {
34193419
terr_ptr_mutability => ~"pointers differ in mutability",
34203420
terr_ref_mutability => ~"references differ in mutability",
34213421
terr_ty_param_size(values) => {
3422-
fmt!("expected a type with %? type params \
3423-
but found one with %? type params",
3422+
fmt!("expected a type with %? type params, \
3423+
found one with %? type params",
34243424
values.expected, values.found)
34253425
}
34263426
terr_tuple_size(values) => {
3427-
fmt!("expected a tuple with %? elements \
3428-
but found one with %? elements",
3427+
fmt!("expected a tuple with %? elements, \
3428+
found one with %? elements",
34293429
values.expected, values.found)
34303430
}
34313431
terr_record_size(values) => {
3432-
fmt!("expected a record with %? fields \
3433-
but found one with %? fields",
3432+
fmt!("expected a record with %? fields, \
3433+
found one with %? fields",
34343434
values.expected, values.found)
34353435
}
34363436
terr_record_mutability => {
34373437
~"record elements differ in mutability"
34383438
}
34393439
terr_record_fields(values) => {
3440-
fmt!("expected a record with field `%s` but found one with field \
3440+
fmt!("expected a record with field `%s`, found one with field \
34413441
`%s`",
34423442
cx.sess.str_of(values.expected),
34433443
cx.sess.str_of(values.found))
@@ -3454,22 +3454,22 @@ pub fn type_err_to_str(cx: ctxt, err: &type_err) -> ~str {
34543454
}
34553455
terr_regions_insufficiently_polymorphic(br, _) => {
34563456
fmt!("expected bound lifetime parameter %s, \
3457-
but found concrete lifetime",
3457+
found concrete lifetime",
34583458
bound_region_ptr_to_str(cx, br))
34593459
}
34603460
terr_regions_overly_polymorphic(br, _) => {
34613461
fmt!("expected concrete lifetime, \
3462-
but found bound lifetime parameter %s",
3462+
found bound lifetime parameter %s",
34633463
bound_region_ptr_to_str(cx, br))
34643464
}
34653465
terr_vstores_differ(k, ref values) => {
3466-
fmt!("%s storage differs: expected %s but found %s",
3466+
fmt!("%s storage differs: expected %s, found %s",
34673467
terr_vstore_kind_to_str(k),
34683468
vstore_to_str(cx, (*values).expected),
34693469
vstore_to_str(cx, (*values).found))
34703470
}
34713471
terr_trait_stores_differ(_, ref values) => {
3472-
fmt!("trait storage differs: expected %s but found %s",
3472+
fmt!("trait storage differs: expected %s, found %s",
34733473
trait_store_to_str(cx, (*values).expected),
34743474
trait_store_to_str(cx, (*values).found))
34753475
}
@@ -3478,38 +3478,38 @@ pub fn type_err_to_str(cx: ctxt, err: &type_err) -> ~str {
34783478
type_err_to_str(cx, err))
34793479
}
34803480
terr_sorts(values) => {
3481-
fmt!("expected %s but found %s",
3481+
fmt!("expected %s, found %s",
34823482
ty_sort_str(cx, values.expected),
34833483
ty_sort_str(cx, values.found))
34843484
}
34853485
terr_traits(values) => {
3486-
fmt!("expected trait %s but found trait %s",
3486+
fmt!("expected trait %s, found trait %s",
34873487
item_path_str(cx, values.expected),
34883488
item_path_str(cx, values.found))
34893489
}
34903490
terr_builtin_bounds(values) => {
34913491
if values.expected.is_empty() {
3492-
fmt!("expected no bounds but found `%s`",
3492+
fmt!("expected no bounds, found `%s`",
34933493
values.found.user_string(cx))
34943494
} else if values.found.is_empty() {
3495-
fmt!("expected bounds `%s` but found no bounds",
3495+
fmt!("expected bounds `%s`, found no bounds",
34963496
values.expected.user_string(cx))
34973497
} else {
3498-
fmt!("expected bounds `%s` but found bounds `%s`",
3498+
fmt!("expected bounds `%s`, found bounds `%s`",
34993499
values.expected.user_string(cx),
35003500
values.found.user_string(cx))
35013501
}
35023502
}
35033503
terr_integer_as_char => {
3504-
fmt!("expected an integral type but found char")
3504+
fmt!("expected an integral type, found char")
35053505
}
35063506
terr_int_mismatch(ref values) => {
3507-
fmt!("expected %s but found %s",
3507+
fmt!("expected %s, found %s",
35083508
values.expected.to_str(),
35093509
values.found.to_str())
35103510
}
35113511
terr_float_mismatch(ref values) => {
3512-
fmt!("expected %s but found %s",
3512+
fmt!("expected %s, found %s",
35133513
values.expected.to_str(),
35143514
values.found.to_str())
35153515
}
@@ -4336,7 +4336,7 @@ pub fn eval_repeat_count<T: ExprTyProvider>(tcx: &T, count_expr: &ast::expr) ->
43364336
const_eval::const_int(count) => if count < 0 {
43374337
tcx.ty_ctxt().sess.span_err(count_expr.span,
43384338
"expected positive integer for \
4339-
repeat count but found negative integer");
4339+
repeat count, found negative integer");
43404340
return 0;
43414341
} else {
43424342
return count as uint
@@ -4345,26 +4345,26 @@ pub fn eval_repeat_count<T: ExprTyProvider>(tcx: &T, count_expr: &ast::expr) ->
43454345
const_eval::const_float(count) => {
43464346
tcx.ty_ctxt().sess.span_err(count_expr.span,
43474347
"expected positive integer for \
4348-
repeat count but found float");
4348+
repeat count, found float");
43494349
return count as uint;
43504350
}
43514351
const_eval::const_str(_) => {
43524352
tcx.ty_ctxt().sess.span_err(count_expr.span,
43534353
"expected positive integer for \
4354-
repeat count but found string");
4354+
repeat count, found string");
43554355
return 0;
43564356
}
43574357
const_eval::const_bool(_) => {
43584358
tcx.ty_ctxt().sess.span_err(count_expr.span,
43594359
"expected positive integer for \
4360-
repeat count but found boolean");
4360+
repeat count, found boolean");
43614361
return 0;
43624362
}
43634363
},
43644364
Err(*) => {
43654365
tcx.ty_ctxt().sess.span_err(count_expr.span,
4366-
"expected constant integer for repeat count \
4367-
but found variable");
4366+
"expected constant integer for repeat count, \
4367+
found variable");
43684368
return 0;
43694369
}
43704370
}

src/librustc/middle/typeck/astconv.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ fn ast_path_substs<AC:AstConv,RS:region_scope + Clone + 'static>(
177177
if !vec::same_length(*decl_generics.type_param_defs, path.types) {
178178
this.tcx().sess.span_fatal(
179179
path.span,
180-
fmt!("wrong number of type arguments: expected %u but found %u",
180+
fmt!("wrong number of type arguments: expected %u, found %u",
181181
decl_generics.type_param_defs.len(), path.types.len()));
182182
}
183183
let tps = path.types.map(|a_t| ast_ty_to_ty(this, rscope, a_t));

src/librustc/middle/typeck/check/_match.rs

+7-7
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ pub fn check_pat_variant(pcx: &pat_ctxt, pat: @ast::pat, path: &ast::Path,
159159
fcx.infcx().type_error_message_str_with_expected(pat.span,
160160
|expected, actual| {
161161
expected.map_move_default(~"", |e| {
162-
fmt!("mismatched types: expected `%s` but found %s",
162+
fmt!("mismatched types: expected `%s`, found %s",
163163
e, actual)})},
164164
Some(expected), ~"a structure pattern",
165165
None);
@@ -202,7 +202,7 @@ pub fn check_pat_variant(pcx: &pat_ctxt, pat: @ast::pat, path: &ast::Path,
202202
fcx.infcx().type_error_message_str_with_expected(pat.span,
203203
|expected, actual| {
204204
expected.map_move_default(~"", |e| {
205-
fmt!("mismatched types: expected `%s` but found %s",
205+
fmt!("mismatched types: expected `%s`, found %s",
206206
e, actual)})},
207207
Some(expected), ~"an enum or structure pattern",
208208
None);
@@ -341,7 +341,7 @@ pub fn check_struct_pat(pcx: &pat_ctxt, pat_id: ast::NodeId, span: span,
341341
Some(&ast::def_struct(*)) | Some(&ast::def_variant(*)) => {
342342
let name = pprust::path_to_str(path, tcx.sess.intr());
343343
tcx.sess.span_err(span,
344-
fmt!("mismatched types: expected `%s` but found `%s`",
344+
fmt!("mismatched types: expected `%s`, found `%s`",
345345
fcx.infcx().ty_to_str(expected),
346346
name));
347347
}
@@ -500,7 +500,7 @@ pub fn check_pat(pcx: &pat_ctxt, pat: @ast::pat, expected: ty::t) {
500500
}
501501
_ => {
502502
tcx.sess.span_err(pat.span,
503-
fmt!("mismatched types: expected `%s` but found struct",
503+
fmt!("mismatched types: expected `%s`, found struct",
504504
fcx.infcx().ty_to_str(expected)));
505505
error_happened = true;
506506
}
@@ -536,7 +536,7 @@ pub fn check_pat(pcx: &pat_ctxt, pat: @ast::pat, expected: ty::t) {
536536
};
537537
fcx.infcx().type_error_message_str_with_expected(pat.span, |expected, actual| {
538538
expected.map_move_default(~"", |e| {
539-
fmt!("mismatched types: expected `%s` but found %s",
539+
fmt!("mismatched types: expected `%s`, found %s",
540540
e, actual)})}, Some(expected), ~"tuple", Some(&type_error));
541541
fcx.write_error(pat.id);
542542
}
@@ -585,7 +585,7 @@ pub fn check_pat(pcx: &pat_ctxt, pat: @ast::pat, expected: ty::t) {
585585
pat.span,
586586
|expected, actual| {
587587
expected.map_move_default(~"", |e| {
588-
fmt!("mismatched types: expected `%s` but found %s",
588+
fmt!("mismatched types: expected `%s`, found %s",
589589
e, actual)})},
590590
Some(expected),
591591
~"a vector pattern",
@@ -643,7 +643,7 @@ pub fn check_pointer_pat(pcx: &pat_ctxt,
643643
span,
644644
|expected, actual| {
645645
expected.map_move_default(~"", |e| {
646-
fmt!("mismatched types: expected `%s` but found %s",
646+
fmt!("mismatched types: expected `%s`, found %s",
647647
e, actual)})},
648648
Some(expected),
649649
fmt!("%s pattern", match pointer_kind {

src/librustc/middle/typeck/check/mod.rs

+11-11
Original file line numberDiff line numberDiff line change
@@ -1310,7 +1310,7 @@ pub fn check_expr_with_unifier(fcx: @mut FnCtxt,
13101310
ty::ty_bool => {}
13111311
_ => fcx.type_error_message(call_expr.span, |actual| {
13121312
fmt!("expected `for` closure to return `bool`, \
1313-
but found `%s`", actual) },
1313+
found `%s`", actual) },
13141314
output, None)
13151315
}
13161316
ty::mk_nil()
@@ -1358,7 +1358,7 @@ pub fn check_expr_with_unifier(fcx: @mut FnCtxt,
13581358
ty::ty_closure(ty::ClosureTy {sig: ref sig, _}) => sig,
13591359
_ => {
13601360
fcx.type_error_message(call_expr.span, |actual| {
1361-
fmt!("expected function but \
1361+
fmt!("expected function, \
13621362
found `%s`", actual) }, fn_ty, None);
13631363
&error_fn_sig
13641364
}
@@ -2750,7 +2750,7 @@ pub fn check_expr_with_unifier(fcx: @mut FnCtxt,
27502750
pub fn require_integral(fcx: @mut FnCtxt, sp: span, t: ty::t) {
27512751
if !type_is_integral(fcx, sp, t) {
27522752
fcx.type_error_message(sp, |actual| {
2753-
fmt!("mismatched types: expected integral type but found `%s`",
2753+
fmt!("mismatched types: expected integral type, found `%s`",
27542754
actual)
27552755
}, t, None);
27562756
}
@@ -3130,28 +3130,28 @@ pub fn ty_param_bounds_and_ty_for_def(fcx: @mut FnCtxt,
31303130
ast::def_ty(_) |
31313131
ast::def_prim_ty(_) |
31323132
ast::def_ty_param(*)=> {
3133-
fcx.ccx.tcx.sess.span_bug(sp, "expected value but found type");
3133+
fcx.ccx.tcx.sess.span_bug(sp, "expected value, found type");
31343134
}
31353135
ast::def_mod(*) | ast::def_foreign_mod(*) => {
3136-
fcx.ccx.tcx.sess.span_bug(sp, "expected value but found module");
3136+
fcx.ccx.tcx.sess.span_bug(sp, "expected value, found module");
31373137
}
31383138
ast::def_use(*) => {
3139-
fcx.ccx.tcx.sess.span_bug(sp, "expected value but found use");
3139+
fcx.ccx.tcx.sess.span_bug(sp, "expected value, found use");
31403140
}
31413141
ast::def_region(*) => {
3142-
fcx.ccx.tcx.sess.span_bug(sp, "expected value but found region");
3142+
fcx.ccx.tcx.sess.span_bug(sp, "expected value, found region");
31433143
}
31443144
ast::def_typaram_binder(*) => {
3145-
fcx.ccx.tcx.sess.span_bug(sp, "expected value but found type parameter");
3145+
fcx.ccx.tcx.sess.span_bug(sp, "expected value, found type parameter");
31463146
}
31473147
ast::def_label(*) => {
3148-
fcx.ccx.tcx.sess.span_bug(sp, "expected value but found label");
3148+
fcx.ccx.tcx.sess.span_bug(sp, "expected value, found label");
31493149
}
31503150
ast::def_self_ty(*) => {
3151-
fcx.ccx.tcx.sess.span_bug(sp, "expected value but found self ty");
3151+
fcx.ccx.tcx.sess.span_bug(sp, "expected value, found self ty");
31523152
}
31533153
ast::def_method(*) => {
3154-
fcx.ccx.tcx.sess.span_bug(sp, "expected value but found method");
3154+
fcx.ccx.tcx.sess.span_bug(sp, "expected value, found method");
31553155
}
31563156
}
31573157
}

src/librustc/middle/typeck/check/vtable.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ fn relate_trait_refs(vcx: &VtableContext,
207207
let tcx = vcx.tcx();
208208
tcx.sess.span_err(
209209
location_info.span,
210-
fmt!("expected %s, but found %s (%s)",
210+
fmt!("expected %s, found %s (%s)",
211211
ppaux::trait_ref_to_str(tcx, &r_exp_trait_ref),
212212
ppaux::trait_ref_to_str(tcx, &r_act_trait_ref),
213213
ty::type_err_to_str(tcx, err)));

src/librustc/middle/typeck/infer/doc.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -240,4 +240,4 @@ We make use of a trait-like impementation strategy to consolidate
240240
duplicated code between subtypes, GLB, and LUB computations. See the
241241
section on "Type Combining" below for details.
242242
243-
*/
243+
*/

0 commit comments

Comments
 (0)