Skip to content

Commit

Permalink
auto merge of #12065 : mrshu/rust/error-formating-fix, r=alexcrichton
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
bors committed Feb 8, 2014
2 parents c8759f6 + ee3fa68 commit cba7ac5
Show file tree
Hide file tree
Showing 74 changed files with 167 additions and 167 deletions.
8 changes: 4 additions & 4 deletions src/librustc/back/link.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ pub fn WriteOutputFile(
let result = llvm::LLVMRustWriteOutputFile(
Target, PM, M, Output, FileType);
if !result {
llvm_err(sess, ~"Could not write output");
llvm_err(sess, ~"could not write output");
}
})
}
Expand Down Expand Up @@ -189,7 +189,7 @@ pub mod write {
for pass in sess.opts.custom_passes.iter() {
pass.with_c_str(|s| {
if !llvm::LLVMRustAddPass(mpm, s) {
sess.warn(format!("Unknown pass {}, ignoring", *pass));
sess.warn(format!("unknown pass {}, ignoring", *pass));
}
})
}
Expand Down Expand Up @@ -876,11 +876,11 @@ fn link_binary_output(sess: Session,
let obj_is_writeable = is_writeable(&obj_filename);
let out_is_writeable = is_writeable(&out_filename);
if !out_is_writeable {
sess.fatal(format!("Output file {} is not writeable -- check its permissions.",
sess.fatal(format!("output file {} is not writeable -- check its permissions.",
out_filename.display()));
}
else if !obj_is_writeable {
sess.fatal(format!("Object file {} is not writeable -- check its permissions.",
sess.fatal(format!("object file {} is not writeable -- check its permissions.",
obj_filename.display()));
}

Expand Down
2 changes: 1 addition & 1 deletion src/librustc/driver/session.rs
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ impl Session_ {
// This exists to help with refactoring to eliminate impossible
// cases later on
pub fn impossible_case(&self, sp: Span, msg: &str) -> ! {
self.span_bug(sp, format!("Impossible case reached: {}", msg));
self.span_bug(sp, format!("impossible case reached: {}", msg));
}
pub fn verbose(&self) -> bool { self.debugging_opt(VERBOSE) }
pub fn time_passes(&self) -> bool { self.debugging_opt(TIME_PASSES) }
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/metadata/tydecode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -527,7 +527,7 @@ fn parse_sig(st: &mut PState, conv: conv_did) -> ty::FnSig {
let variadic = match next(st) {
'V' => true,
'N' => false,
r => fail!(format!("Bad variadic: {}", r)),
r => fail!(format!("bad variadic: {}", r)),
};
let ret_ty = parse_ty(st, |x,y| conv(x,y));
ty::FnSig {binder_id: id,
Expand Down
6 changes: 3 additions & 3 deletions src/librustc/metadata/tyencode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ fn enc_region(w: &mut MemWriter, cx: @ctxt, r: ty::Region) {
}
ty::ReInfer(_) => {
// these should not crop up after typeck
cx.diag.handler().bug("Cannot encode region variables");
cx.diag.handler().bug("cannot encode region variables");
}
}
}
Expand Down Expand Up @@ -320,7 +320,7 @@ fn enc_sty(w: &mut MemWriter, cx: @ctxt, st: &ty::sty) {
enc_bare_fn_ty(w, cx, f);
}
ty::ty_infer(_) => {
cx.diag.handler().bug("Cannot encode inference variable types");
cx.diag.handler().bug("cannot encode inference variable types");
}
ty::ty_param(param_ty {idx: id, def_id: did}) => {
mywrite!(w, "p{}|{}", (cx.ds)(did), id);
Expand All @@ -334,7 +334,7 @@ fn enc_sty(w: &mut MemWriter, cx: @ctxt, st: &ty::sty) {
enc_substs(w, cx, substs);
mywrite!(w, "]");
}
ty::ty_err => fail!("Shouldn't encode error type")
ty::ty_err => fail!("shouldn't encode error type")
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/librustc/middle/borrowck/gather_loans/lifetime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ impl<'a> GuaranteeLifetimeContext<'a> {
// the check above should fail for anything is not ReScope
self.bccx.tcx.sess.span_bug(
cmt_base.span,
format!("Cannot issue root for scope region: {:?}",
format!("cannot issue root for scope region: {:?}",
self.loan_region));
}
};
Expand Down
4 changes: 2 additions & 2 deletions src/librustc/middle/borrowck/gather_loans/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -496,7 +496,7 @@ impl<'a> GatherLoanCtxt<'a> {
ty::ReInfer(..) => {
self.tcx().sess.span_bug(
cmt.span,
format!("Invalid borrow lifetime: {:?}", loan_region));
format!("invalid borrow lifetime: {:?}", loan_region));
}
};
debug!("loan_scope = {:?}", loan_scope);
Expand Down Expand Up @@ -820,7 +820,7 @@ impl<'a> GatherLoanCtxt<'a> {
_ => {
self.tcx().sess.span_bug(
pat.span,
format!("Type of slice pattern is not a slice"));
format!("type of slice pattern is not a slice"));
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/librustc/middle/borrowck/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -769,14 +769,14 @@ impl BorrowckCtxt {
}
_ => {
self.tcx.sess.bug(
format!("Loan path LpVar({:?}) maps to {:?}, not local",
format!("loan path LpVar({:?}) maps to {:?}, not local",
id, pat));
}
}
}
r => {
self.tcx.sess.bug(
format!("Loan path LpVar({:?}) maps to {:?}, not local",
format!("loan path LpVar({:?}) maps to {:?}, not local",
id, r));
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/middle/borrowck/move_data.rs
Original file line number Diff line number Diff line change
Expand Up @@ -494,7 +494,7 @@ impl MoveData {
dfcx_assign.add_kill(kill_id, assignment_index);
}
LpExtend(..) => {
tcx.sess.bug("Var assignment for non var path");
tcx.sess.bug("var assignment for non var path");
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/librustc/middle/cfg/construct.rs
Original file line number Diff line number Diff line change
Expand Up @@ -507,13 +507,13 @@ impl CFGBuilder {
}
self.tcx.sess.span_bug(
expr.span,
format!("No loop scope for id {:?}", loop_id));
format!("no loop scope for id {:?}", loop_id));
}

r => {
self.tcx.sess.span_bug(
expr.span,
format!("Bad entry `{:?}` in def_map for label", r));
format!("bad entry `{:?}` in def_map for label", r));
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/middle/check_match.rs
Original file line number Diff line number Diff line change
Expand Up @@ -971,7 +971,7 @@ fn check_legality_of_move_bindings(cx: &MatchCheckCtxt,
_ => {
cx.tcx.sess.span_bug(
p.span,
format!("Binding pattern {} is \
format!("binding pattern {} is \
not an identifier: {:?}",
p.id, p.node));
}
Expand Down
30 changes: 15 additions & 15 deletions src/librustc/middle/const_eval.rs
Original file line number Diff line number Diff line change
Expand Up @@ -342,8 +342,8 @@ pub fn eval_const_expr_partial<T: ty::ExprTyProvider>(tcx: &T, e: &Expr)
Ok(const_float(f)) => Ok(const_float(-f)),
Ok(const_int(i)) => Ok(const_int(-i)),
Ok(const_uint(i)) => Ok(const_uint(-i)),
Ok(const_str(_)) => Err(~"Negate on string"),
Ok(const_bool(_)) => Err(~"Negate on boolean"),
Ok(const_str(_)) => Err(~"negate on string"),
Ok(const_bool(_)) => Err(~"negate on boolean"),
ref err => ((*err).clone())
}
}
Expand All @@ -352,7 +352,7 @@ pub fn eval_const_expr_partial<T: ty::ExprTyProvider>(tcx: &T, e: &Expr)
Ok(const_int(i)) => Ok(const_int(!i)),
Ok(const_uint(i)) => Ok(const_uint(!i)),
Ok(const_bool(b)) => Ok(const_bool(!b)),
_ => Err(~"Not on float or string")
_ => Err(~"not on float or string")
}
}
ExprBinary(_, op, a, b) => {
Expand All @@ -371,7 +371,7 @@ pub fn eval_const_expr_partial<T: ty::ExprTyProvider>(tcx: &T, e: &Expr)
BiNe => fromb(a != b),
BiGe => fromb(a >= b),
BiGt => fromb(a > b),
_ => Err(~"Can't do this op on floats")
_ => Err(~"can't do this op on floats")
}
}
(Ok(const_int(a)), Ok(const_int(b))) => {
Expand Down Expand Up @@ -423,14 +423,14 @@ pub fn eval_const_expr_partial<T: ty::ExprTyProvider>(tcx: &T, e: &Expr)
match op {
BiShl => Ok(const_int(a << b)),
BiShr => Ok(const_int(a >> b)),
_ => Err(~"Can't do this op on an int and uint")
_ => Err(~"can't do this op on an int and uint")
}
}
(Ok(const_uint(a)), Ok(const_int(b))) => {
match op {
BiShl => Ok(const_uint(a << b)),
BiShr => Ok(const_uint(a >> b)),
_ => Err(~"Can't do this op on a uint and int")
_ => Err(~"can't do this op on a uint and int")
}
}
(Ok(const_bool(a)), Ok(const_bool(b))) => {
Expand All @@ -442,10 +442,10 @@ pub fn eval_const_expr_partial<T: ty::ExprTyProvider>(tcx: &T, e: &Expr)
BiBitOr => a | b,
BiEq => a == b,
BiNe => a != b,
_ => return Err(~"Can't do this op on bools")
_ => return Err(~"can't do this op on bools")
}))
}
_ => Err(~"Bad operands for binary")
_ => Err(~"bad operands for binary")
}
}
ExprCast(base, target_ty) => {
Expand All @@ -456,7 +456,7 @@ pub fn eval_const_expr_partial<T: ty::ExprTyProvider>(tcx: &T, e: &Expr)
.or_else(|| astconv::ast_ty_to_prim_ty(tcx.ty_ctxt(), target_ty))
.unwrap_or_else(|| tcx.ty_ctxt().sess.span_fatal(
target_ty.span,
format!("Target type not found for const cast")
format!("target type not found for const cast")
));

let base = eval_const_expr_partial(tcx, base);
Expand All @@ -469,41 +469,41 @@ pub fn eval_const_expr_partial<T: ty::ExprTyProvider>(tcx: &T, e: &Expr)
const_uint(u) => Ok(const_float(u as f64)),
const_int(i) => Ok(const_float(i as f64)),
const_float(f) => Ok(const_float(f)),
_ => Err(~"Can't cast float to str"),
_ => Err(~"can't cast float to str"),
}
}
ty::ty_uint(_) => {
match val {
const_uint(u) => Ok(const_uint(u)),
const_int(i) => Ok(const_uint(i as u64)),
const_float(f) => Ok(const_uint(f as u64)),
_ => Err(~"Can't cast str to uint"),
_ => Err(~"can't cast str to uint"),
}
}
ty::ty_int(_) | ty::ty_bool => {
match val {
const_uint(u) => Ok(const_int(u as i64)),
const_int(i) => Ok(const_int(i)),
const_float(f) => Ok(const_int(f as i64)),
_ => Err(~"Can't cast str to int"),
_ => Err(~"can't cast str to int"),
}
}
_ => Err(~"Can't cast this type")
_ => Err(~"can't cast this type")
}
}
}
}
ExprPath(_) => {
match lookup_const(tcx.ty_ctxt(), e) {
Some(actual_e) => eval_const_expr_partial(&tcx.ty_ctxt(), actual_e),
None => Err(~"Non-constant path in constant expr")
None => Err(~"non-constant path in constant expr")
}
}
ExprLit(lit) => Ok(lit_to_const(lit)),
// If we have a vstore, just keep going; it has to be a string
ExprVstore(e, _) => eval_const_expr_partial(tcx, e),
ExprParen(e) => eval_const_expr_partial(tcx, e),
_ => Err(~"Unsupported constant expr")
_ => Err(~"unsupported constant expr")
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/librustc/middle/dataflow.rs
Original file line number Diff line number Diff line change
Expand Up @@ -879,15 +879,15 @@ impl<'a, O:DataFlowOperator> PropagationContext<'a, O> {
None => {
self.tcx().sess.span_bug(
expr.span,
format!("No loop scope for id {:?}", loop_id));
format!("no loop scope for id {:?}", loop_id));
}
}
}

r => {
self.tcx().sess.span_bug(
expr.span,
format!("Bad entry `{:?}` in def_map for label", r));
format!("bad entry `{:?}` in def_map for label", r));
}
}
}
Expand Down
10 changes: 5 additions & 5 deletions src/librustc/middle/liveness.rs
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ impl IrMaps {
Some(&var) => var,
None => {
self.tcx.sess.span_bug(
span, format!("No variable registered for id {}", node_id));
span, format!("no variable registered for id {}", node_id));
}
}
}
Expand Down Expand Up @@ -627,7 +627,7 @@ impl Liveness {
// code have to agree about which AST nodes are worth
// creating liveness nodes for.
self.tcx.sess.span_bug(
span, format!("No live node registered for node {}",
span, format!("no live node registered for node {}",
node_id));
}
}
Expand Down Expand Up @@ -759,7 +759,7 @@ impl Liveness {
let def_map = self.tcx.def_map.borrow();
match def_map.get().find(&id) {
Some(&DefLabel(loop_id)) => loop_id,
_ => self.tcx.sess.span_bug(sp, "Label on break/loop \
_ => self.tcx.sess.span_bug(sp, "label on break/loop \
doesn't refer to a loop")
}
}
Expand Down Expand Up @@ -1152,7 +1152,7 @@ impl Liveness {
match break_ln.get().find(&sc) {
Some(&b) => b,
None => self.tcx.sess.span_bug(expr.span,
"Break to unknown label")
"break to unknown label")
}
}

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

Expand Down
6 changes: 3 additions & 3 deletions src/librustc/middle/mem_categorization.rs
Original file line number Diff line number Diff line change
Expand Up @@ -548,7 +548,7 @@ impl mem_categorization_ctxt {
_ => {
self.tcx.sess.span_bug(
span,
format!("Upvar of non-closure {:?} - {}",
format!("upvar of non-closure {:?} - {}",
fn_node_id, ty.repr(self.tcx)));
}
}
Expand Down Expand Up @@ -652,7 +652,7 @@ impl mem_categorization_ctxt {
None => {
self.tcx.sess.span_bug(
node.span(),
format!("Explicit deref of non-derefable type: {}",
format!("explicit deref of non-derefable type: {}",
ty_to_str(self.tcx, base_cmt.ty)));
}
};
Expand Down Expand Up @@ -745,7 +745,7 @@ impl mem_categorization_ctxt {
None => {
self.tcx.sess.span_bug(
elt.span(),
format!("Explicit index of non-index type `{}`",
format!("explicit index of non-index type `{}`",
ty_to_str(self.tcx, base_cmt.ty)));
}
};
Expand Down
6 changes: 3 additions & 3 deletions src/librustc/middle/region.rs
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ impl RegionMaps {
let scope_map = self.scope_map.borrow();
match scope_map.get().find(&id) {
Some(&r) => r,
None => { fail!("No enclosing scope for id {}", id); }
None => { fail!("no enclosing scope for id {}", id); }
}
}

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

Expand Down Expand Up @@ -554,7 +554,7 @@ fn resolve_local(visitor: &mut RegionResolutionVisitor,
None => {
visitor.sess.span_bug(
local.span,
"Local without enclosing block");
"local without enclosing block");
}
};

Expand Down
Loading

0 comments on commit cba7ac5

Please sign in to comment.