auto merge of #11495 : kud1ing/rust/backticks, r=huonw
This commit is contained in:
commit
1fda761e9c
@ -3439,13 +3439,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))
|
||||
}
|
||||
@ -3459,7 +3459,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))
|
||||
}
|
||||
|
@ -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)
|
||||
@ -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)
|
||||
},
|
||||
@ -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)
|
||||
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -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`
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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"; }
|
||||
|
@ -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; }
|
||||
|
@ -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; }
|
||||
|
@ -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; }
|
||||
|
@ -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`
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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() {
|
||||
|
@ -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
|
||||
}
|
||||
|
@ -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`
|
||||
}
|
||||
|
@ -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`
|
||||
}
|
||||
|
@ -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?
|
||||
}
|
||||
|
@ -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() { }
|
||||
|
@ -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`
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user