Skip to content

More backticks in error messages #11495

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 12, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/librustc/middle/ty.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3458,13 +3458,13 @@ pub fn type_err_to_str(cx: ctxt, err: &type_err) -> ~str {
bound_region_ptr_to_str(cx, br))
}
terr_vstores_differ(k, ref values) => {
format!("{} storage differs: expected {} but found {}",
format!("{} storage differs: expected `{}` but found `{}`",
terr_vstore_kind_to_str(k),
vstore_to_str(cx, (*values).expected),
vstore_to_str(cx, (*values).found))
}
terr_trait_stores_differ(_, ref values) => {
format!("trait storage differs: expected {} but found {}",
format!("trait storage differs: expected `{}` but found `{}`",
trait_store_to_str(cx, (*values).expected),
trait_store_to_str(cx, (*values).found))
}
Expand All @@ -3478,7 +3478,7 @@ pub fn type_err_to_str(cx: ctxt, err: &type_err) -> ~str {
ty_sort_str(cx, values.found))
}
terr_traits(values) => {
format!("expected trait {} but found trait {}",
format!("expected trait `{}` but found trait `{}`",
item_path_str(cx, values.expected),
item_path_str(cx, values.found))
}
Expand Down
8 changes: 4 additions & 4 deletions src/librustc/middle/typeck/check/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2131,7 +2131,7 @@ pub fn check_expr_with_unifier(fcx: @FnCtxt,
fcx.write_error(expr.id);
fcx.write_error(rhs.id);
fcx.type_error_message(expr.span, |actual| {
format!("binary operation {} cannot be applied \
format!("binary operation `{}` cannot be applied \
to type `{}`",
ast_util::binop_to_str(op), actual)},
lhs_t, None)
Expand All @@ -2153,7 +2153,7 @@ pub fn check_expr_with_unifier(fcx: @FnCtxt,
fcx.type_error_message(expr.span,
|actual| {
format!("binary assignment operation \
{}= cannot be applied to type `{}`",
`{}=` cannot be applied to type `{}`",
ast_util::binop_to_str(op),
actual)
},
Expand Down Expand Up @@ -2182,7 +2182,7 @@ pub fn check_expr_with_unifier(fcx: @FnCtxt,
Some(ref name) => {
let if_op_unbound = || {
fcx.type_error_message(ex.span, |actual| {
format!("binary operation {} cannot be applied \
format!("binary operation `{}` cannot be applied \
to type `{}`",
ast_util::binop_to_str(op), actual)},
lhs_resolved_t, None)
Expand Down Expand Up @@ -2850,7 +2850,7 @@ pub fn check_expr_with_unifier(fcx: @FnCtxt,
_ => {
fcx.type_error_message(expr.span,
|actual| {
format!("type {} cannot be dereferenced", actual)
format!("type `{}` cannot be dereferenced", actual)
}, oprnd_t, None);
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/test/compile-fail/assignment-operator-unimplemented.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@ struct Foo;
fn main() {
let mut a = Foo;
let ref b = Foo;
a += *b; //~ Error: binary assignment operation += cannot be applied to type `Foo`
a += *b; //~ Error: binary assignment operation `+=` cannot be applied to type `Foo`
}
4 changes: 2 additions & 2 deletions src/test/compile-fail/autoderef-full-lval.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@ struct fish {
fn main() {
let a: clam = clam{x: @1, y: @2};
let b: clam = clam{x: @10, y: @20};
let z: int = a.x + b.y; //~ ERROR binary operation + cannot be applied to type `@int`
let z: int = a.x + b.y; //~ ERROR binary operation `+` cannot be applied to type `@int`
info!("{:?}", z);
assert_eq!(z, 21);
let forty: fish = fish{a: @40};
let two: fish = fish{a: @2};
let answer: int = forty.a + two.a; //~ ERROR binary operation + cannot be applied to type `@int`
let answer: int = forty.a + two.a; //~ ERROR binary operation `+` cannot be applied to type `@int`
info!("{:?}", answer);
assert_eq!(answer, 42);
}
2 changes: 1 addition & 1 deletion src/test/compile-fail/binop-bitxor-str.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

// error-pattern:^ cannot be applied to type `~str`
// error-pattern:`^` cannot be applied to type `~str`

fn main() { let x = ~"a" ^ ~"b"; }
2 changes: 1 addition & 1 deletion src/test/compile-fail/binop-logic-float.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

// error-pattern:|| cannot be applied to type `f32`
// error-pattern:`||` cannot be applied to type `f32`

fn main() { let x = 1.0_f32 || 2.0_f32; }
2 changes: 1 addition & 1 deletion src/test/compile-fail/binop-logic-int.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

// error-pattern:&& cannot be applied to type `int`
// error-pattern:`&&` cannot be applied to type `int`

fn main() { let x = 1i && 2i; }
2 changes: 1 addition & 1 deletion src/test/compile-fail/binop-mul-bool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

// error-pattern:* cannot be applied to type `bool`
// error-pattern:`*` cannot be applied to type `bool`

fn main() { let x = true * false; }
2 changes: 1 addition & 1 deletion src/test/compile-fail/binop-typeck.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@ fn main() {
let x = true;
let y = 1;
let z = x + y;
//~^ ERROR binary operation + cannot be applied to type `bool`
//~^ ERROR binary operation `+` cannot be applied to type `bool`
}
8 changes: 4 additions & 4 deletions src/test/compile-fail/estr-subtyping.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,19 @@ fn wants_slice(x: &str) { }

fn has_box(x: @str) {
wants_box(x);
wants_uniq(x); //~ ERROR str storage differs: expected ~ but found @
wants_uniq(x); //~ ERROR str storage differs: expected `~` but found `@`
wants_slice(x);
}

fn has_uniq(x: ~str) {
wants_box(x); //~ ERROR str storage differs: expected @ but found ~
wants_box(x); //~ ERROR str storage differs: expected `@` but found `~`
wants_uniq(x);
wants_slice(x);
}

fn has_slice(x: &str) {
wants_box(x); //~ ERROR str storage differs: expected @ but found &
wants_uniq(x); //~ ERROR str storage differs: expected ~ but found &
wants_box(x); //~ ERROR str storage differs: expected `@` but found `&`
wants_uniq(x); //~ ERROR str storage differs: expected `~` but found `&`
wants_slice(x);
}

Expand Down
18 changes: 9 additions & 9 deletions src/test/compile-fail/evec-subtyping.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,26 +16,26 @@ fn wants_three(x: [uint, ..3]) { }

fn has_box(x: @[uint]) {
wants_box(x);
wants_uniq(x); //~ ERROR [] storage differs: expected ~ but found @
wants_three(x); //~ ERROR [] storage differs: expected 3 but found @
wants_uniq(x); //~ ERROR [] storage differs: expected `~` but found `@`
wants_three(x); //~ ERROR [] storage differs: expected `3` but found `@`
}

fn has_uniq(x: ~[uint]) {
wants_box(x); //~ ERROR [] storage differs: expected @ but found ~
wants_box(x); //~ ERROR [] storage differs: expected `@` but found `~`
wants_uniq(x);
wants_three(x); //~ ERROR [] storage differs: expected 3 but found ~
wants_three(x); //~ ERROR [] storage differs: expected `3` but found `~`
}

fn has_three(x: [uint, ..3]) {
wants_box(x); //~ ERROR [] storage differs: expected @ but found 3
wants_uniq(x); //~ ERROR [] storage differs: expected ~ but found 3
wants_box(x); //~ ERROR [] storage differs: expected `@` but found `3`
wants_uniq(x); //~ ERROR [] storage differs: expected `~` but found `3`
wants_three(x);
}

fn has_four(x: [uint, ..4]) {
wants_box(x); //~ ERROR [] storage differs: expected @ but found 4
wants_uniq(x); //~ ERROR [] storage differs: expected ~ but found 4
wants_three(x); //~ ERROR [] storage differs: expected 3 but found 4
wants_box(x); //~ ERROR [] storage differs: expected `@` but found `4`
wants_uniq(x); //~ ERROR [] storage differs: expected `~` but found `4`
wants_three(x); //~ ERROR [] storage differs: expected `3` but found `4`
}

fn main() {
Expand Down
2 changes: 1 addition & 1 deletion src/test/compile-fail/fn-compare-mismatch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@ fn main() {
fn f() { }
fn g() { }
let x = f == g;
//~^ ERROR binary operation == cannot be applied
//~^ ERROR binary operation `==` cannot be applied
}
2 changes: 1 addition & 1 deletion src/test/compile-fail/issue-3820.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,5 @@ impl Thing {
fn main() {
let u = Thing {x: 2};
let _v = u.mul(&3); // This is ok
let w = u * 3; //~ ERROR binary operation * cannot be applied to type `Thing`
let w = u * 3; //~ ERROR binary operation `*` cannot be applied to type `Thing`
}
2 changes: 1 addition & 1 deletion src/test/compile-fail/issue-5239-1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@
// Regression test for issue #5239

fn main() {
let x: |int| -> int = |ref x| { x += 1; }; //~ ERROR binary assignment operation += cannot be applied to type `&int`
let x: |int| -> int = |ref x| { x += 1; }; //~ ERROR binary assignment operation `+=` cannot be applied to type `&int`
}
4 changes: 2 additions & 2 deletions src/test/compile-fail/missing-do.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
fn foo(f: ||) { f() }

fn main() {
~"" || 42; //~ ERROR binary operation || cannot be applied to type
foo || {}; //~ ERROR binary operation || cannot be applied to type
~"" || 42; //~ ERROR binary operation `||` cannot be applied to type
foo || {}; //~ ERROR binary operation `||` cannot be applied to type
//~^ NOTE did you forget the `do` keyword for the call?
}
2 changes: 1 addition & 1 deletion src/test/compile-fail/pattern-tyvar-2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@ extern mod extra;
enum bar { t1((), Option<~[int]>), t2, }

// n.b. my change changes this error message, but I think it's right -- tjc
fn foo(t: bar) -> int { match t { t1(_, Some(x)) => { return x * 3; } _ => { fail!(); } } } //~ ERROR binary operation * cannot be applied to
fn foo(t: bar) -> int { match t { t1(_, Some(x)) => { return x * 3; } _ => { fail!(); } } } //~ ERROR binary operation `*` cannot be applied to

fn main() { }
2 changes: 1 addition & 1 deletion src/test/compile-fail/type-mismatch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@ fn main() {
let x = true;
let y = 1;
let z = x + y;
//~^ ERROR binary operation + cannot be applied to type `bool`
//~^ ERROR binary operation `+` cannot be applied to type `bool`
}