diff options
Diffstat (limited to 'src/librustc')
| -rw-r--r-- | src/librustc/metadata/tydecode.rs | 4 | ||||
| -rw-r--r-- | src/librustc/middle/effect.rs | 2 | ||||
| -rw-r--r-- | src/librustc/middle/ty.rs | 60 | ||||
| -rw-r--r-- | src/librustc/middle/typeck/astconv.rs | 6 | ||||
| -rw-r--r-- | src/librustc/middle/typeck/check/_match.rs | 16 | ||||
| -rw-r--r-- | src/librustc/middle/typeck/check/mod.rs | 34 | ||||
| -rw-r--r-- | src/librustc/middle/typeck/check/vtable.rs | 2 | ||||
| -rw-r--r-- | src/librustc/middle/typeck/infer/error_reporting.rs | 4 | ||||
| -rw-r--r-- | src/librustc/middle/typeck/infer/mod.rs | 2 |
9 files changed, 65 insertions, 65 deletions
diff --git a/src/librustc/metadata/tydecode.rs b/src/librustc/metadata/tydecode.rs index e6e7d8bf8d1..b26a12d5cfc 100644 --- a/src/librustc/metadata/tydecode.rs +++ b/src/librustc/metadata/tydecode.rs @@ -575,12 +575,12 @@ pub fn parse_def_id(buf: &[u8]) -> ast::DefId { let crate_num = match uint::parse_bytes(crate_part, 10u) { Some(cn) => cn as ast::CrateNum, - None => fail!("internal error: parse_def_id: crate number expected, but found {:?}", + None => fail!("internal error: parse_def_id: crate number expected, found {:?}", crate_part) }; let def_num = match uint::parse_bytes(def_part, 10u) { Some(dn) => dn as ast::NodeId, - None => fail!("internal error: parse_def_id: id expected, but found {:?}", + None => fail!("internal error: parse_def_id: id expected, found {:?}", def_part) }; ast::DefId { krate: crate_num, node: def_num } diff --git a/src/librustc/middle/effect.rs b/src/librustc/middle/effect.rs index e6160038b1d..dc4ecb35830 100644 --- a/src/librustc/middle/effect.rs +++ b/src/librustc/middle/effect.rs @@ -122,7 +122,7 @@ impl<'a> Visitor<()> for EffectCheckVisitor<'a> { // we need to create a new context, when we're // - outside `unsafe` and found a `unsafe` block // (normal case) - // - inside `unsafe` but found an `unsafe` block + // - inside `unsafe`, found an `unsafe` block // created internally to the compiler // // The second case is necessary to ensure that the diff --git a/src/librustc/middle/ty.rs b/src/librustc/middle/ty.rs index 2b768c811e7..dc463ffe5df 100644 --- a/src/librustc/middle/ty.rs +++ b/src/librustc/middle/ty.rs @@ -3603,17 +3603,17 @@ pub fn type_err_to_str(cx: &ctxt, err: &type_err) -> String { match *err { terr_mismatch => "types differ".to_string(), terr_fn_style_mismatch(values) => { - format!("expected {} fn but found {} fn", + format!("expected {} fn, found {} fn", values.expected.to_string(), values.found.to_string()) } terr_abi_mismatch(values) => { - format!("expected {} fn but found {} fn", + format!("expected {} fn, found {} fn", values.expected.to_string(), values.found.to_string()) } terr_onceness_mismatch(values) => { - format!("expected {} fn but found {} fn", + format!("expected {} fn, found {} fn", values.expected.to_string(), values.found.to_string()) } @@ -3630,20 +3630,20 @@ pub fn type_err_to_str(cx: &ctxt, err: &type_err) -> String { terr_ptr_mutability => "pointers differ in mutability".to_string(), terr_ref_mutability => "references differ in mutability".to_string(), terr_ty_param_size(values) => { - format!("expected a type with {} type params \ - but found one with {} type params", + format!("expected a type with {} type params, \ + found one with {} type params", values.expected, values.found) } terr_tuple_size(values) => { - format!("expected a tuple with {} elements \ - but found one with {} elements", + format!("expected a tuple with {} elements, \ + found one with {} elements", values.expected, values.found) } terr_record_size(values) => { - format!("expected a record with {} fields \ - but found one with {} fields", + format!("expected a record with {} fields, \ + found one with {} fields", values.expected, values.found) } @@ -3651,7 +3651,7 @@ pub fn type_err_to_str(cx: &ctxt, err: &type_err) -> String { "record elements differ in mutability".to_string() } terr_record_fields(values) => { - format!("expected a record with field `{}` but found one \ + format!("expected a record with field `{}`, found one \ with field `{}`", token::get_ident(values.expected), token::get_ident(values.found)) @@ -3670,57 +3670,57 @@ pub fn type_err_to_str(cx: &ctxt, err: &type_err) -> String { } terr_regions_insufficiently_polymorphic(br, _) => { format!("expected bound lifetime parameter {}, \ - but found concrete lifetime", + found concrete lifetime", bound_region_ptr_to_string(cx, br)) } terr_regions_overly_polymorphic(br, _) => { format!("expected concrete lifetime, \ - but found bound lifetime parameter {}", + found bound lifetime parameter {}", bound_region_ptr_to_string(cx, br)) } terr_trait_stores_differ(_, ref values) => { - format!("trait storage differs: expected `{}` but found `{}`", + format!("trait storage differs: expected `{}`, found `{}`", trait_store_to_string(cx, (*values).expected), trait_store_to_string(cx, (*values).found)) } terr_sorts(values) => { - format!("expected {} but found {}", + format!("expected {}, found {}", ty_sort_string(cx, values.expected), ty_sort_string(cx, values.found)) } terr_traits(values) => { - format!("expected trait `{}` but found trait `{}`", + format!("expected trait `{}`, found trait `{}`", item_path_str(cx, values.expected), item_path_str(cx, values.found)) } terr_builtin_bounds(values) => { if values.expected.is_empty() { - format!("expected no bounds but found `{}`", + format!("expected no bounds, found `{}`", values.found.user_string(cx)) } else if values.found.is_empty() { - format!("expected bounds `{}` but found no bounds", + format!("expected bounds `{}`, found no bounds", values.expected.user_string(cx)) } else { - format!("expected bounds `{}` but found bounds `{}`", + format!("expected bounds `{}`, found bounds `{}`", values.expected.user_string(cx), values.found.user_string(cx)) } } terr_integer_as_char => { - "expected an integral type but found `char`".to_string() + "expected an integral type, found `char`".to_string() } terr_int_mismatch(ref values) => { - format!("expected `{}` but found `{}`", + format!("expected `{}`, found `{}`", values.expected.to_string(), values.found.to_string()) } terr_float_mismatch(ref values) => { - format!("expected `{}` but found `{}`", + format!("expected `{}`, found `{}`", values.expected.to_string(), values.found.to_string()) } terr_variadic_mismatch(ref values) => { - format!("expected {} fn but found {} function", + format!("expected {} fn, found {} function", if values.expected { "variadic" } else { "non-variadic" }, if values.found { "variadic" } else { "non-variadic" }) } @@ -4548,7 +4548,7 @@ pub fn eval_repeat_count<T: ExprTyProvider>(tcx: &T, count_expr: &ast::Expr) -> const_eval::const_int(count) => if count < 0 { tcx.ty_ctxt().sess.span_err(count_expr.span, "expected positive integer for \ - repeat count but found negative integer"); + repeat count, found negative integer"); return 0; } else { return count as uint @@ -4557,38 +4557,38 @@ pub fn eval_repeat_count<T: ExprTyProvider>(tcx: &T, count_expr: &ast::Expr) -> const_eval::const_float(count) => { tcx.ty_ctxt().sess.span_err(count_expr.span, "expected positive integer for \ - repeat count but found float"); + repeat count, found float"); return count as uint; } const_eval::const_str(_) => { tcx.ty_ctxt().sess.span_err(count_expr.span, "expected positive integer for \ - repeat count but found string"); + repeat count, found string"); return 0; } const_eval::const_bool(_) => { tcx.ty_ctxt().sess.span_err(count_expr.span, "expected positive integer for \ - repeat count but found boolean"); + repeat count, found boolean"); return 0; } const_eval::const_binary(_) => { tcx.ty_ctxt().sess.span_err(count_expr.span, "expected positive integer for \ - repeat count but found binary array"); + repeat count, found binary array"); return 0; } const_eval::const_nil => { tcx.ty_ctxt().sess.span_err(count_expr.span, "expected positive integer for \ - repeat count but found ()"); + repeat count, found ()"); return 0; } }, Err(..) => { tcx.ty_ctxt().sess.span_err(count_expr.span, - "expected constant integer for repeat count \ - but found variable"); + "expected constant integer for repeat count, \ + found variable"); return 0; } } diff --git a/src/librustc/middle/typeck/astconv.rs b/src/librustc/middle/typeck/astconv.rs index d646dc9c082..129a039a267 100644 --- a/src/librustc/middle/typeck/astconv.rs +++ b/src/librustc/middle/typeck/astconv.rs @@ -191,7 +191,7 @@ fn ast_path_substs<AC:AstConv,RS:RegionScope>( if supplied_num_region_params != 0 || anon_regions.is_err() { span_err!(tcx.sess, path.span, E0107, - "wrong number of lifetime parameters: expected {} but found {}", + "wrong number of lifetime parameters: expected {}, found {}", expected_num_region_params, supplied_num_region_params); } @@ -216,7 +216,7 @@ fn ast_path_substs<AC:AstConv,RS:RegionScope>( "expected" }; this.tcx().sess.span_fatal(path.span, - format!("wrong number of type arguments: {} {} but found {}", + format!("wrong number of type arguments: {} {}, found {}", expected, required_ty_param_count, supplied_ty_param_count).as_slice()); @@ -227,7 +227,7 @@ fn ast_path_substs<AC:AstConv,RS:RegionScope>( "expected" }; this.tcx().sess.span_fatal(path.span, - format!("wrong number of type arguments: {} {} but found {}", + format!("wrong number of type arguments: {} {}, found {}", expected, formal_ty_param_count, supplied_ty_param_count).as_slice()); diff --git a/src/librustc/middle/typeck/check/_match.rs b/src/librustc/middle/typeck/check/_match.rs index ff49aa8a40b..18f4607a83c 100644 --- a/src/librustc/middle/typeck/check/_match.rs +++ b/src/librustc/middle/typeck/check/_match.rs @@ -169,7 +169,7 @@ pub fn check_pat_variant(pcx: &pat_ctxt, pat: &ast::Pat, path: &ast::Path, fcx.infcx().type_error_message_str_with_expected(pat.span, |expected, actual| { expected.map_or("".to_string(), |e| { - format!("mismatched types: expected `{}` but found {}", + format!("mismatched types: expected `{}`, found {}", e, actual) })}, Some(expected), @@ -223,7 +223,7 @@ pub fn check_pat_variant(pcx: &pat_ctxt, pat: &ast::Pat, path: &ast::Path, |expected, actual| { expected.map_or("".to_string(), |e| { - format!("mismatched types: expected `{}` but found {}", + format!("mismatched types: expected `{}`, found {}", e, actual) }) }, @@ -395,7 +395,7 @@ pub fn check_struct_like_enum_variant_pat(pcx: &pat_ctxt, Some(&def::DefTy(..)) => { let name = pprust::path_to_string(path); span_err!(tcx.sess, span, E0028, - "mismatched types: expected `{}` but found `{}`", + "mismatched types: expected `{}`, found `{}`", fcx.infcx().ty_to_string(expected), name); } _ => { @@ -548,7 +548,7 @@ pub fn check_pat(pcx: &pat_ctxt, pat: &ast::Pat, expected: ty::t) { expected.map_or("".to_string(), |e| { format!("mismatched types: expected \ - `{}` but found {}", e, actual) + `{}`, found {}", e, actual) })}, Some(expected), "a structure pattern".to_string(), @@ -607,8 +607,8 @@ pub fn check_pat(pcx: &pat_ctxt, pat: &ast::Pat, expected: ty::t) { |expected, actual| { expected.map_or("".to_string(), |e| { - format!("mismatched types: expected `{}` \ - but found {}", e, actual) + format!("mismatched types: expected `{}`, \ + found {}", e, actual) } )}, Some(expected), @@ -645,7 +645,7 @@ pub fn check_pat(pcx: &pat_ctxt, pat: &ast::Pat, expected: ty::t) { |expected, actual| { expected.map_or("".to_string(), |e| { - format!("mismatched types: expected `{}` but found {}", + format!("mismatched types: expected `{}`, found {}", e, actual) }) }, @@ -763,7 +763,7 @@ fn check_pointer_pat(pcx: &pat_ctxt, span, |expected, actual| { expected.map_or("".to_string(), |e| { - format!("mismatched types: expected `{}` but found {}", + format!("mismatched types: expected `{}`, found {}", e, actual) }) }, diff --git a/src/librustc/middle/typeck/check/mod.rs b/src/librustc/middle/typeck/check/mod.rs index 8a9c147f60f..02115590c7e 100644 --- a/src/librustc/middle/typeck/check/mod.rs +++ b/src/librustc/middle/typeck/check/mod.rs @@ -2313,7 +2313,7 @@ fn check_expr_with_unifier(fcx: &FnCtxt, ty::ty_closure(box ty::ClosureTy {sig: ref sig, ..}) => sig, _ => { fcx.type_error_message(call_expr.span, |actual| { - format!("expected function but found `{}`", actual) + format!("expected function, found `{}`", actual) }, fn_ty, None); &error_fn_sig } @@ -3811,7 +3811,7 @@ impl Repr for Expectation { pub fn require_uint(fcx: &FnCtxt, sp: Span, t: ty::t) { if !type_is_uint(fcx, sp, t) { fcx.type_error_message(sp, |actual| { - format!("mismatched types: expected `uint` type but found `{}`", + format!("mismatched types: expected `uint` type, found `{}`", actual) }, t, None); } @@ -3820,7 +3820,7 @@ pub fn require_uint(fcx: &FnCtxt, sp: Span, t: ty::t) { pub fn require_integral(fcx: &FnCtxt, sp: Span, t: ty::t) { if !type_is_integral(fcx, sp, t) { fcx.type_error_message(sp, |actual| { - format!("mismatched types: expected integral type but found `{}`", + format!("mismatched types: expected integral type, found `{}`", actual) }, t, None); } @@ -4336,28 +4336,28 @@ pub fn polytype_for_def(fcx: &FnCtxt, def::DefTy(_) | def::DefPrimTy(_) | def::DefTyParam(..)=> { - fcx.ccx.tcx.sess.span_bug(sp, "expected value but found type"); + fcx.ccx.tcx.sess.span_bug(sp, "expected value, found type"); } def::DefMod(..) | def::DefForeignMod(..) => { - fcx.ccx.tcx.sess.span_bug(sp, "expected value but found module"); + fcx.ccx.tcx.sess.span_bug(sp, "expected value, found module"); } def::DefUse(..) => { - fcx.ccx.tcx.sess.span_bug(sp, "expected value but found use"); + fcx.ccx.tcx.sess.span_bug(sp, "expected value, found use"); } def::DefRegion(..) => { - fcx.ccx.tcx.sess.span_bug(sp, "expected value but found region"); + fcx.ccx.tcx.sess.span_bug(sp, "expected value, found region"); } def::DefTyParamBinder(..) => { - fcx.ccx.tcx.sess.span_bug(sp, "expected value but found type parameter"); + fcx.ccx.tcx.sess.span_bug(sp, "expected value, found type parameter"); } def::DefLabel(..) => { - fcx.ccx.tcx.sess.span_bug(sp, "expected value but found label"); + fcx.ccx.tcx.sess.span_bug(sp, "expected value, found label"); } def::DefSelfTy(..) => { - fcx.ccx.tcx.sess.span_bug(sp, "expected value but found self ty"); + fcx.ccx.tcx.sess.span_bug(sp, "expected value, found self ty"); } def::DefMethod(..) => { - fcx.ccx.tcx.sess.span_bug(sp, "expected value but found method"); + fcx.ccx.tcx.sess.span_bug(sp, "expected value, found method"); } } } @@ -4585,8 +4585,8 @@ pub fn instantiate_path(fcx: &FnCtxt, } else if i == type_count { span_err!(fcx.tcx().sess, typ.span, E0087, "too many type parameters provided: \ - expected at most {} parameter(s) \ - but found {} parameter(s)", + expected at most {} parameter(s), \ + found {} parameter(s)", type_count, segment.types.len()); substs.types.truncate(space, 0); } @@ -4603,7 +4603,7 @@ pub fn instantiate_path(fcx: &FnCtxt, } else if i == region_count { span_err!(fcx.tcx().sess, lifetime.span, E0088, "too many lifetime parameters provided: \ - expected {} parameter(s) but found {} parameter(s)", + expected {} parameter(s), found {} parameter(s)", region_count, segment.lifetimes.len()); substs.mut_regions().truncate(space, 0); @@ -4652,7 +4652,7 @@ pub fn instantiate_path(fcx: &FnCtxt, if desired.len() != required_len { "at least " } else { "" }; span_err!(fcx.tcx().sess, span, E0089, "too few type parameters provided: expected {}{} parameter(s) \ - but found {} parameter(s)", + , found {} parameter(s)", qualifier, required_len, provided_len); substs.types.replace(space, Vec::from_elem(desired.len(), ty::mk_err())); @@ -4705,8 +4705,8 @@ pub fn instantiate_path(fcx: &FnCtxt, // Otherwise, too few were provided. Report an error and then // use inference variables. span_err!(fcx.tcx().sess, span, E0090, - "too few lifetime parameters provided: expected {} parameter(s) \ - but found {} parameter(s)", + "too few lifetime parameters provided: expected {} parameter(s), \ + found {} parameter(s)", desired.len(), provided_len); substs.mut_regions().replace( diff --git a/src/librustc/middle/typeck/check/vtable.rs b/src/librustc/middle/typeck/check/vtable.rs index 30afe761a48..bc53ed58f6f 100644 --- a/src/librustc/middle/typeck/check/vtable.rs +++ b/src/librustc/middle/typeck/check/vtable.rs @@ -206,7 +206,7 @@ fn relate_trait_refs(vcx: &VtableContext, !ty::trait_ref_contains_error(&r_exp_trait_ref) { let tcx = vcx.tcx(); - span_err!(tcx.sess, span, E0095, "expected {}, but found {} ({})", + span_err!(tcx.sess, span, E0095, "expected {}, found {} ({})", ppaux::trait_ref_to_string(tcx, &r_exp_trait_ref), ppaux::trait_ref_to_string(tcx, &r_act_trait_ref), ty::type_err_to_str(tcx, err)); diff --git a/src/librustc/middle/typeck/infer/error_reporting.rs b/src/librustc/middle/typeck/infer/error_reporting.rs index beaf81409a3..5b9b37ab844 100644 --- a/src/librustc/middle/typeck/infer/error_reporting.rs +++ b/src/librustc/middle/typeck/infer/error_reporting.rs @@ -377,7 +377,7 @@ impl<'a> ErrorReporting for InferCtxt<'a> { fn values_str(&self, values: &ValuePairs) -> Option<String> { /*! - * Returns a string of the form "expected `{}` but found `{}`", + * Returns a string of the form "expected `{}`, found `{}`", * or None if this is a derived error. */ match *values { @@ -405,7 +405,7 @@ impl<'a> ErrorReporting for InferCtxt<'a> { return None; } - Some(format!("expected `{}` but found `{}`", + Some(format!("expected `{}`, found `{}`", expected.user_string(self.tcx), found.user_string(self.tcx))) } diff --git a/src/librustc/middle/typeck/infer/mod.rs b/src/librustc/middle/typeck/infer/mod.rs index 30fffc42a3f..5629a085500 100644 --- a/src/librustc/middle/typeck/infer/mod.rs +++ b/src/librustc/middle/typeck/infer/mod.rs @@ -799,7 +799,7 @@ impl<'a> InferCtxt<'a> { _ => { // if I leave out : String, it infers &str and complains |actual: String| { - format!("mismatched types: expected `{}` but found `{}`", + format!("mismatched types: expected `{}`, found `{}`", self.ty_to_string(resolved_expected), actual) } |
