Skip to content

Commit cba7ac5

Browse files
committed
auto merge of #12065 : mrshu/rust/error-formating-fix, r=alexcrichton
This pull request tries to fix #12050. I went after these wrong errors quite aggressively so it might be that I also changed some strings that are not actual errors. Please point those out and I will update this pull request accordingly.
2 parents c8759f6 + ee3fa68 commit cba7ac5

Some content is hidden

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

74 files changed

+167
-167
lines changed

src/librustc/back/link.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ pub fn WriteOutputFile(
7676
let result = llvm::LLVMRustWriteOutputFile(
7777
Target, PM, M, Output, FileType);
7878
if !result {
79-
llvm_err(sess, ~"Could not write output");
79+
llvm_err(sess, ~"could not write output");
8080
}
8181
})
8282
}
@@ -189,7 +189,7 @@ pub mod write {
189189
for pass in sess.opts.custom_passes.iter() {
190190
pass.with_c_str(|s| {
191191
if !llvm::LLVMRustAddPass(mpm, s) {
192-
sess.warn(format!("Unknown pass {}, ignoring", *pass));
192+
sess.warn(format!("unknown pass {}, ignoring", *pass));
193193
}
194194
})
195195
}
@@ -876,11 +876,11 @@ fn link_binary_output(sess: Session,
876876
let obj_is_writeable = is_writeable(&obj_filename);
877877
let out_is_writeable = is_writeable(&out_filename);
878878
if !out_is_writeable {
879-
sess.fatal(format!("Output file {} is not writeable -- check its permissions.",
879+
sess.fatal(format!("output file {} is not writeable -- check its permissions.",
880880
out_filename.display()));
881881
}
882882
else if !obj_is_writeable {
883-
sess.fatal(format!("Object file {} is not writeable -- check its permissions.",
883+
sess.fatal(format!("object file {} is not writeable -- check its permissions.",
884884
obj_filename.display()));
885885
}
886886

src/librustc/driver/session.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,7 @@ impl Session_ {
308308
// This exists to help with refactoring to eliminate impossible
309309
// cases later on
310310
pub fn impossible_case(&self, sp: Span, msg: &str) -> ! {
311-
self.span_bug(sp, format!("Impossible case reached: {}", msg));
311+
self.span_bug(sp, format!("impossible case reached: {}", msg));
312312
}
313313
pub fn verbose(&self) -> bool { self.debugging_opt(VERBOSE) }
314314
pub fn time_passes(&self) -> bool { self.debugging_opt(TIME_PASSES) }

src/librustc/metadata/tydecode.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -527,7 +527,7 @@ fn parse_sig(st: &mut PState, conv: conv_did) -> ty::FnSig {
527527
let variadic = match next(st) {
528528
'V' => true,
529529
'N' => false,
530-
r => fail!(format!("Bad variadic: {}", r)),
530+
r => fail!(format!("bad variadic: {}", r)),
531531
};
532532
let ret_ty = parse_ty(st, |x,y| conv(x,y));
533533
ty::FnSig {binder_id: id,

src/librustc/metadata/tyencode.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ fn enc_region(w: &mut MemWriter, cx: @ctxt, r: ty::Region) {
195195
}
196196
ty::ReInfer(_) => {
197197
// these should not crop up after typeck
198-
cx.diag.handler().bug("Cannot encode region variables");
198+
cx.diag.handler().bug("cannot encode region variables");
199199
}
200200
}
201201
}
@@ -320,7 +320,7 @@ fn enc_sty(w: &mut MemWriter, cx: @ctxt, st: &ty::sty) {
320320
enc_bare_fn_ty(w, cx, f);
321321
}
322322
ty::ty_infer(_) => {
323-
cx.diag.handler().bug("Cannot encode inference variable types");
323+
cx.diag.handler().bug("cannot encode inference variable types");
324324
}
325325
ty::ty_param(param_ty {idx: id, def_id: did}) => {
326326
mywrite!(w, "p{}|{}", (cx.ds)(did), id);
@@ -334,7 +334,7 @@ fn enc_sty(w: &mut MemWriter, cx: @ctxt, st: &ty::sty) {
334334
enc_substs(w, cx, substs);
335335
mywrite!(w, "]");
336336
}
337-
ty::ty_err => fail!("Shouldn't encode error type")
337+
ty::ty_err => fail!("shouldn't encode error type")
338338
}
339339
}
340340

src/librustc/middle/borrowck/gather_loans/lifetime.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ impl<'a> GuaranteeLifetimeContext<'a> {
215215
// the check above should fail for anything is not ReScope
216216
self.bccx.tcx.sess.span_bug(
217217
cmt_base.span,
218-
format!("Cannot issue root for scope region: {:?}",
218+
format!("cannot issue root for scope region: {:?}",
219219
self.loan_region));
220220
}
221221
};

src/librustc/middle/borrowck/gather_loans/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -496,7 +496,7 @@ impl<'a> GatherLoanCtxt<'a> {
496496
ty::ReInfer(..) => {
497497
self.tcx().sess.span_bug(
498498
cmt.span,
499-
format!("Invalid borrow lifetime: {:?}", loan_region));
499+
format!("invalid borrow lifetime: {:?}", loan_region));
500500
}
501501
};
502502
debug!("loan_scope = {:?}", loan_scope);
@@ -820,7 +820,7 @@ impl<'a> GatherLoanCtxt<'a> {
820820
_ => {
821821
self.tcx().sess.span_bug(
822822
pat.span,
823-
format!("Type of slice pattern is not a slice"));
823+
format!("type of slice pattern is not a slice"));
824824
}
825825
}
826826
}

src/librustc/middle/borrowck/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -769,14 +769,14 @@ impl BorrowckCtxt {
769769
}
770770
_ => {
771771
self.tcx.sess.bug(
772-
format!("Loan path LpVar({:?}) maps to {:?}, not local",
772+
format!("loan path LpVar({:?}) maps to {:?}, not local",
773773
id, pat));
774774
}
775775
}
776776
}
777777
r => {
778778
self.tcx.sess.bug(
779-
format!("Loan path LpVar({:?}) maps to {:?}, not local",
779+
format!("loan path LpVar({:?}) maps to {:?}, not local",
780780
id, r));
781781
}
782782
}

src/librustc/middle/borrowck/move_data.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -494,7 +494,7 @@ impl MoveData {
494494
dfcx_assign.add_kill(kill_id, assignment_index);
495495
}
496496
LpExtend(..) => {
497-
tcx.sess.bug("Var assignment for non var path");
497+
tcx.sess.bug("var assignment for non var path");
498498
}
499499
}
500500
}

src/librustc/middle/cfg/construct.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -507,13 +507,13 @@ impl CFGBuilder {
507507
}
508508
self.tcx.sess.span_bug(
509509
expr.span,
510-
format!("No loop scope for id {:?}", loop_id));
510+
format!("no loop scope for id {:?}", loop_id));
511511
}
512512

513513
r => {
514514
self.tcx.sess.span_bug(
515515
expr.span,
516-
format!("Bad entry `{:?}` in def_map for label", r));
516+
format!("bad entry `{:?}` in def_map for label", r));
517517
}
518518
}
519519
}

src/librustc/middle/check_match.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -971,7 +971,7 @@ fn check_legality_of_move_bindings(cx: &MatchCheckCtxt,
971971
_ => {
972972
cx.tcx.sess.span_bug(
973973
p.span,
974-
format!("Binding pattern {} is \
974+
format!("binding pattern {} is \
975975
not an identifier: {:?}",
976976
p.id, p.node));
977977
}

src/librustc/middle/const_eval.rs

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -342,8 +342,8 @@ pub fn eval_const_expr_partial<T: ty::ExprTyProvider>(tcx: &T, e: &Expr)
342342
Ok(const_float(f)) => Ok(const_float(-f)),
343343
Ok(const_int(i)) => Ok(const_int(-i)),
344344
Ok(const_uint(i)) => Ok(const_uint(-i)),
345-
Ok(const_str(_)) => Err(~"Negate on string"),
346-
Ok(const_bool(_)) => Err(~"Negate on boolean"),
345+
Ok(const_str(_)) => Err(~"negate on string"),
346+
Ok(const_bool(_)) => Err(~"negate on boolean"),
347347
ref err => ((*err).clone())
348348
}
349349
}
@@ -352,7 +352,7 @@ pub fn eval_const_expr_partial<T: ty::ExprTyProvider>(tcx: &T, e: &Expr)
352352
Ok(const_int(i)) => Ok(const_int(!i)),
353353
Ok(const_uint(i)) => Ok(const_uint(!i)),
354354
Ok(const_bool(b)) => Ok(const_bool(!b)),
355-
_ => Err(~"Not on float or string")
355+
_ => Err(~"not on float or string")
356356
}
357357
}
358358
ExprBinary(_, op, a, b) => {
@@ -371,7 +371,7 @@ pub fn eval_const_expr_partial<T: ty::ExprTyProvider>(tcx: &T, e: &Expr)
371371
BiNe => fromb(a != b),
372372
BiGe => fromb(a >= b),
373373
BiGt => fromb(a > b),
374-
_ => Err(~"Can't do this op on floats")
374+
_ => Err(~"can't do this op on floats")
375375
}
376376
}
377377
(Ok(const_int(a)), Ok(const_int(b))) => {
@@ -423,14 +423,14 @@ pub fn eval_const_expr_partial<T: ty::ExprTyProvider>(tcx: &T, e: &Expr)
423423
match op {
424424
BiShl => Ok(const_int(a << b)),
425425
BiShr => Ok(const_int(a >> b)),
426-
_ => Err(~"Can't do this op on an int and uint")
426+
_ => Err(~"can't do this op on an int and uint")
427427
}
428428
}
429429
(Ok(const_uint(a)), Ok(const_int(b))) => {
430430
match op {
431431
BiShl => Ok(const_uint(a << b)),
432432
BiShr => Ok(const_uint(a >> b)),
433-
_ => Err(~"Can't do this op on a uint and int")
433+
_ => Err(~"can't do this op on a uint and int")
434434
}
435435
}
436436
(Ok(const_bool(a)), Ok(const_bool(b))) => {
@@ -442,10 +442,10 @@ pub fn eval_const_expr_partial<T: ty::ExprTyProvider>(tcx: &T, e: &Expr)
442442
BiBitOr => a | b,
443443
BiEq => a == b,
444444
BiNe => a != b,
445-
_ => return Err(~"Can't do this op on bools")
445+
_ => return Err(~"can't do this op on bools")
446446
}))
447447
}
448-
_ => Err(~"Bad operands for binary")
448+
_ => Err(~"bad operands for binary")
449449
}
450450
}
451451
ExprCast(base, target_ty) => {
@@ -456,7 +456,7 @@ pub fn eval_const_expr_partial<T: ty::ExprTyProvider>(tcx: &T, e: &Expr)
456456
.or_else(|| astconv::ast_ty_to_prim_ty(tcx.ty_ctxt(), target_ty))
457457
.unwrap_or_else(|| tcx.ty_ctxt().sess.span_fatal(
458458
target_ty.span,
459-
format!("Target type not found for const cast")
459+
format!("target type not found for const cast")
460460
));
461461

462462
let base = eval_const_expr_partial(tcx, base);
@@ -469,41 +469,41 @@ pub fn eval_const_expr_partial<T: ty::ExprTyProvider>(tcx: &T, e: &Expr)
469469
const_uint(u) => Ok(const_float(u as f64)),
470470
const_int(i) => Ok(const_float(i as f64)),
471471
const_float(f) => Ok(const_float(f)),
472-
_ => Err(~"Can't cast float to str"),
472+
_ => Err(~"can't cast float to str"),
473473
}
474474
}
475475
ty::ty_uint(_) => {
476476
match val {
477477
const_uint(u) => Ok(const_uint(u)),
478478
const_int(i) => Ok(const_uint(i as u64)),
479479
const_float(f) => Ok(const_uint(f as u64)),
480-
_ => Err(~"Can't cast str to uint"),
480+
_ => Err(~"can't cast str to uint"),
481481
}
482482
}
483483
ty::ty_int(_) | ty::ty_bool => {
484484
match val {
485485
const_uint(u) => Ok(const_int(u as i64)),
486486
const_int(i) => Ok(const_int(i)),
487487
const_float(f) => Ok(const_int(f as i64)),
488-
_ => Err(~"Can't cast str to int"),
488+
_ => Err(~"can't cast str to int"),
489489
}
490490
}
491-
_ => Err(~"Can't cast this type")
491+
_ => Err(~"can't cast this type")
492492
}
493493
}
494494
}
495495
}
496496
ExprPath(_) => {
497497
match lookup_const(tcx.ty_ctxt(), e) {
498498
Some(actual_e) => eval_const_expr_partial(&tcx.ty_ctxt(), actual_e),
499-
None => Err(~"Non-constant path in constant expr")
499+
None => Err(~"non-constant path in constant expr")
500500
}
501501
}
502502
ExprLit(lit) => Ok(lit_to_const(lit)),
503503
// If we have a vstore, just keep going; it has to be a string
504504
ExprVstore(e, _) => eval_const_expr_partial(tcx, e),
505505
ExprParen(e) => eval_const_expr_partial(tcx, e),
506-
_ => Err(~"Unsupported constant expr")
506+
_ => Err(~"unsupported constant expr")
507507
}
508508
}
509509

src/librustc/middle/dataflow.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -879,15 +879,15 @@ impl<'a, O:DataFlowOperator> PropagationContext<'a, O> {
879879
None => {
880880
self.tcx().sess.span_bug(
881881
expr.span,
882-
format!("No loop scope for id {:?}", loop_id));
882+
format!("no loop scope for id {:?}", loop_id));
883883
}
884884
}
885885
}
886886

887887
r => {
888888
self.tcx().sess.span_bug(
889889
expr.span,
890-
format!("Bad entry `{:?}` in def_map for label", r));
890+
format!("bad entry `{:?}` in def_map for label", r));
891891
}
892892
}
893893
}

src/librustc/middle/liveness.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,7 @@ impl IrMaps {
328328
Some(&var) => var,
329329
None => {
330330
self.tcx.sess.span_bug(
331-
span, format!("No variable registered for id {}", node_id));
331+
span, format!("no variable registered for id {}", node_id));
332332
}
333333
}
334334
}
@@ -627,7 +627,7 @@ impl Liveness {
627627
// code have to agree about which AST nodes are worth
628628
// creating liveness nodes for.
629629
self.tcx.sess.span_bug(
630-
span, format!("No live node registered for node {}",
630+
span, format!("no live node registered for node {}",
631631
node_id));
632632
}
633633
}
@@ -759,7 +759,7 @@ impl Liveness {
759759
let def_map = self.tcx.def_map.borrow();
760760
match def_map.get().find(&id) {
761761
Some(&DefLabel(loop_id)) => loop_id,
762-
_ => self.tcx.sess.span_bug(sp, "Label on break/loop \
762+
_ => self.tcx.sess.span_bug(sp, "label on break/loop \
763763
doesn't refer to a loop")
764764
}
765765
}
@@ -1152,7 +1152,7 @@ impl Liveness {
11521152
match break_ln.get().find(&sc) {
11531153
Some(&b) => b,
11541154
None => self.tcx.sess.span_bug(expr.span,
1155-
"Break to unknown label")
1155+
"break to unknown label")
11561156
}
11571157
}
11581158

@@ -1167,7 +1167,7 @@ impl Liveness {
11671167
match cont_ln.get().find(&sc) {
11681168
Some(&b) => b,
11691169
None => self.tcx.sess.span_bug(expr.span,
1170-
"Loop to unknown label")
1170+
"loop to unknown label")
11711171
}
11721172
}
11731173

src/librustc/middle/mem_categorization.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -548,7 +548,7 @@ impl mem_categorization_ctxt {
548548
_ => {
549549
self.tcx.sess.span_bug(
550550
span,
551-
format!("Upvar of non-closure {:?} - {}",
551+
format!("upvar of non-closure {:?} - {}",
552552
fn_node_id, ty.repr(self.tcx)));
553553
}
554554
}
@@ -652,7 +652,7 @@ impl mem_categorization_ctxt {
652652
None => {
653653
self.tcx.sess.span_bug(
654654
node.span(),
655-
format!("Explicit deref of non-derefable type: {}",
655+
format!("explicit deref of non-derefable type: {}",
656656
ty_to_str(self.tcx, base_cmt.ty)));
657657
}
658658
};
@@ -745,7 +745,7 @@ impl mem_categorization_ctxt {
745745
None => {
746746
self.tcx.sess.span_bug(
747747
elt.span(),
748-
format!("Explicit index of non-index type `{}`",
748+
format!("explicit index of non-index type `{}`",
749749
ty_to_str(self.tcx, base_cmt.ty)));
750750
}
751751
};

src/librustc/middle/region.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ impl RegionMaps {
142142
let scope_map = self.scope_map.borrow();
143143
match scope_map.get().find(&id) {
144144
Some(&r) => r,
145-
None => { fail!("No enclosing scope for id {}", id); }
145+
None => { fail!("no enclosing scope for id {}", id); }
146146
}
147147
}
148148

@@ -154,7 +154,7 @@ impl RegionMaps {
154154
let var_map = self.var_map.borrow();
155155
match var_map.get().find(&var_id) {
156156
Some(&r) => r,
157-
None => { fail!("No enclosing scope for id {}", var_id); }
157+
None => { fail!("no enclosing scope for id {}", var_id); }
158158
}
159159
}
160160

@@ -554,7 +554,7 @@ fn resolve_local(visitor: &mut RegionResolutionVisitor,
554554
None => {
555555
visitor.sess.span_bug(
556556
local.span,
557-
"Local without enclosing block");
557+
"local without enclosing block");
558558
}
559559
};
560560

0 commit comments

Comments
 (0)