Skip to content

Commit 113cc0e

Browse files
author
Lenny222
committed
adjust error message to coding style
1 parent 91b7118 commit 113cc0e

File tree

153 files changed

+271
-272
lines changed

Some content is hidden

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

153 files changed

+271
-272
lines changed

src/libextra/ebml.rs

Lines changed: 2 additions & 2 deletions
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

Lines changed: 4 additions & 4 deletions
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

Lines changed: 2 additions & 2 deletions
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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -415,7 +415,7 @@ pub fn assert_is_binding_or_wild(bcx: @mut Block, p: @ast::pat) {
415415
if !pat_is_binding_or_wild(bcx.tcx().def_map, p) {
416416
bcx.sess().span_bug(
417417
p.span,
418-
fmt!("Expected an identifier pattern but found p: %s",
418+
fmt!("Expected an identifier pattern, found p: %s",
419419
pat_to_str(p, bcx.sess().intr())));
420420
}
421421
}

src/librustc/middle/ty.rs

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -3389,15 +3389,15 @@ pub fn type_err_to_str(cx: ctxt, err: &type_err) -> ~str {
33893389
match *err {
33903390
terr_mismatch => ~"types differ",
33913391
terr_purity_mismatch(values) => {
3392-
fmt!("expected %s fn but found %s fn",
3392+
fmt!("expected %s fn, found %s fn",
33933393
values.expected.to_str(), values.found.to_str())
33943394
}
33953395
terr_abi_mismatch(values) => {
3396-
fmt!("expected %s fn but found %s fn",
3396+
fmt!("expected %s fn, found %s fn",
33973397
values.expected.to_str(), values.found.to_str())
33983398
}
33993399
terr_onceness_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_sigil_mismatch(values) => {
@@ -3411,25 +3411,25 @@ pub fn type_err_to_str(cx: ctxt, err: &type_err) -> ~str {
34113411
terr_ptr_mutability => ~"pointers differ in mutability",
34123412
terr_ref_mutability => ~"references differ in mutability",
34133413
terr_ty_param_size(values) => {
3414-
fmt!("expected a type with %? type params \
3415-
but found one with %? type params",
3414+
fmt!("expected a type with %? type params, \
3415+
found one with %? type params",
34163416
values.expected, values.found)
34173417
}
34183418
terr_tuple_size(values) => {
3419-
fmt!("expected a tuple with %? elements \
3420-
but found one with %? elements",
3419+
fmt!("expected a tuple with %? elements, \
3420+
found one with %? elements",
34213421
values.expected, values.found)
34223422
}
34233423
terr_record_size(values) => {
3424-
fmt!("expected a record with %? fields \
3425-
but found one with %? fields",
3424+
fmt!("expected a record with %? fields, \
3425+
found one with %? fields",
34263426
values.expected, values.found)
34273427
}
34283428
terr_record_mutability => {
34293429
~"record elements differ in mutability"
34303430
}
34313431
terr_record_fields(values) => {
3432-
fmt!("expected a record with field `%s` but found one with field \
3432+
fmt!("expected a record with field `%s`, found one with field \
34333433
`%s`",
34343434
cx.sess.str_of(values.expected),
34353435
cx.sess.str_of(values.found))
@@ -3446,22 +3446,22 @@ pub fn type_err_to_str(cx: ctxt, err: &type_err) -> ~str {
34463446
}
34473447
terr_regions_insufficiently_polymorphic(br, _) => {
34483448
fmt!("expected bound lifetime parameter %s, \
3449-
but found concrete lifetime",
3449+
found concrete lifetime",
34503450
bound_region_ptr_to_str(cx, br))
34513451
}
34523452
terr_regions_overly_polymorphic(br, _) => {
34533453
fmt!("expected concrete lifetime, \
3454-
but found bound lifetime parameter %s",
3454+
found bound lifetime parameter %s",
34553455
bound_region_ptr_to_str(cx, br))
34563456
}
34573457
terr_vstores_differ(k, ref values) => {
3458-
fmt!("%s storage differs: expected %s but found %s",
3458+
fmt!("%s storage differs: expected %s, found %s",
34593459
terr_vstore_kind_to_str(k),
34603460
vstore_to_str(cx, (*values).expected),
34613461
vstore_to_str(cx, (*values).found))
34623462
}
34633463
terr_trait_stores_differ(_, ref values) => {
3464-
fmt!("trait storage differs: expected %s but found %s",
3464+
fmt!("trait storage differs: expected %s, found %s",
34653465
trait_store_to_str(cx, (*values).expected),
34663466
trait_store_to_str(cx, (*values).found))
34673467
}
@@ -3470,38 +3470,38 @@ pub fn type_err_to_str(cx: ctxt, err: &type_err) -> ~str {
34703470
type_err_to_str(cx, err))
34713471
}
34723472
terr_sorts(values) => {
3473-
fmt!("expected %s but found %s",
3473+
fmt!("expected %s, found %s",
34743474
ty_sort_str(cx, values.expected),
34753475
ty_sort_str(cx, values.found))
34763476
}
34773477
terr_traits(values) => {
3478-
fmt!("expected trait %s but found trait %s",
3478+
fmt!("expected trait %s, found trait %s",
34793479
item_path_str(cx, values.expected),
34803480
item_path_str(cx, values.found))
34813481
}
34823482
terr_builtin_bounds(values) => {
34833483
if values.expected.is_empty() {
3484-
fmt!("expected no bounds but found `%s`",
3484+
fmt!("expected no bounds, found `%s`",
34853485
values.found.user_string(cx))
34863486
} else if values.found.is_empty() {
3487-
fmt!("expected bounds `%s` but found no bounds",
3487+
fmt!("expected bounds `%s`, found no bounds",
34883488
values.expected.user_string(cx))
34893489
} else {
3490-
fmt!("expected bounds `%s` but found bounds `%s`",
3490+
fmt!("expected bounds `%s`, found bounds `%s`",
34913491
values.expected.user_string(cx),
34923492
values.found.user_string(cx))
34933493
}
34943494
}
34953495
terr_integer_as_char => {
3496-
fmt!("expected an integral type but found char")
3496+
fmt!("expected an integral type, found char")
34973497
}
34983498
terr_int_mismatch(ref values) => {
3499-
fmt!("expected %s but found %s",
3499+
fmt!("expected %s, found %s",
35003500
values.expected.to_str(),
35013501
values.found.to_str())
35023502
}
35033503
terr_float_mismatch(ref values) => {
3504-
fmt!("expected %s but found %s",
3504+
fmt!("expected %s, found %s",
35053505
values.expected.to_str(),
35063506
values.found.to_str())
35073507
}
@@ -4327,7 +4327,7 @@ pub fn eval_repeat_count<T: ExprTyProvider>(tcx: &T, count_expr: &ast::expr) ->
43274327
const_eval::const_int(count) => if count < 0 {
43284328
tcx.ty_ctxt().sess.span_err(count_expr.span,
43294329
"expected positive integer for \
4330-
repeat count but found negative integer");
4330+
repeat count, found negative integer");
43314331
return 0;
43324332
} else {
43334333
return count as uint
@@ -4336,26 +4336,26 @@ pub fn eval_repeat_count<T: ExprTyProvider>(tcx: &T, count_expr: &ast::expr) ->
43364336
const_eval::const_float(count) => {
43374337
tcx.ty_ctxt().sess.span_err(count_expr.span,
43384338
"expected positive integer for \
4339-
repeat count but found float");
4339+
repeat count, found float");
43404340
return count as uint;
43414341
}
43424342
const_eval::const_str(_) => {
43434343
tcx.ty_ctxt().sess.span_err(count_expr.span,
43444344
"expected positive integer for \
4345-
repeat count but found string");
4345+
repeat count, found string");
43464346
return 0;
43474347
}
43484348
const_eval::const_bool(_) => {
43494349
tcx.ty_ctxt().sess.span_err(count_expr.span,
43504350
"expected positive integer for \
4351-
repeat count but found boolean");
4351+
repeat count, found boolean");
43524352
return 0;
43534353
}
43544354
},
43554355
Err(*) => {
43564356
tcx.ty_ctxt().sess.span_err(count_expr.span,
4357-
"expected constant integer for repeat count \
4358-
but found variable");
4357+
"expected constant integer for \
4358+
repeat count, found variable");
43594359
return 0;
43604360
}
43614361
}

src/librustc/middle/typeck/astconv.rs

Lines changed: 1 addition & 1 deletion
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

Lines changed: 7 additions & 7 deletions
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_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_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_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_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_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

Lines changed: 11 additions & 12 deletions
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,8 +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 \
1362-
found `%s`", actual) }, fn_ty, None);
1361+
fmt!("expected function, found `%s`", actual) }, fn_ty, None);
13631362
&error_fn_sig
13641363
}
13651364
};
@@ -2751,7 +2750,7 @@ pub fn check_expr_with_unifier(fcx: @mut FnCtxt,
27512750
pub fn require_integral(fcx: @mut FnCtxt, sp: span, t: ty::t) {
27522751
if !type_is_integral(fcx, sp, t) {
27532752
fcx.type_error_message(sp, |actual| {
2754-
fmt!("mismatched types: expected integral type but found `%s`",
2753+
fmt!("mismatched types: expected integral type, found `%s`",
27552754
actual)
27562755
}, t, None);
27572756
}
@@ -3131,28 +3130,28 @@ pub fn ty_param_bounds_and_ty_for_def(fcx: @mut FnCtxt,
31313130
ast::def_ty(_) |
31323131
ast::def_prim_ty(_) |
31333132
ast::def_ty_param(*)=> {
3134-
fcx.ccx.tcx.sess.span_bug(sp, "expected value but found type");
3133+
fcx.ccx.tcx.sess.span_bug(sp, "expected value, found type");
31353134
}
31363135
ast::def_mod(*) | ast::def_foreign_mod(*) => {
3137-
fcx.ccx.tcx.sess.span_bug(sp, "expected value but found module");
3136+
fcx.ccx.tcx.sess.span_bug(sp, "expected value, found module");
31383137
}
31393138
ast::def_use(*) => {
3140-
fcx.ccx.tcx.sess.span_bug(sp, "expected value but found use");
3139+
fcx.ccx.tcx.sess.span_bug(sp, "expected value, found use");
31413140
}
31423141
ast::def_region(*) => {
3143-
fcx.ccx.tcx.sess.span_bug(sp, "expected value but found region");
3142+
fcx.ccx.tcx.sess.span_bug(sp, "expected value, found region");
31443143
}
31453144
ast::def_typaram_binder(*) => {
3146-
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");
31473146
}
31483147
ast::def_label(*) => {
3149-
fcx.ccx.tcx.sess.span_bug(sp, "expected value but found label");
3148+
fcx.ccx.tcx.sess.span_bug(sp, "expected value, found label");
31503149
}
31513150
ast::def_self_ty(*) => {
3152-
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");
31533152
}
31543153
ast::def_method(*) => {
3155-
fcx.ccx.tcx.sess.span_bug(sp, "expected value but found method");
3154+
fcx.ccx.tcx.sess.span_bug(sp, "expected value, found method");
31563155
}
31573156
}
31583157
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ fn relate_trait_refs(vcx: &VtableContext,
209209
let tcx = vcx.tcx();
210210
tcx.sess.span_err(
211211
location_info.span,
212-
fmt!("expected %s, but found %s (%s)",
212+
fmt!("expected %s, found %s (%s)",
213213
ppaux::trait_ref_to_str(tcx, &r_exp_trait_ref),
214214
ppaux::trait_ref_to_str(tcx, &r_act_trait_ref),
215215
ty::type_err_to_str(tcx, err)));

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

Lines changed: 1 addition & 1 deletion
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)