Skip to content

Commit

Permalink
Update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
LeSeulArtichaut committed Dec 12, 2019
1 parent 27810e2 commit eac6fac
Show file tree
Hide file tree
Showing 22 changed files with 44 additions and 44 deletions.
4 changes: 2 additions & 2 deletions src/test/ui/autoderef-full-lval.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@ fn main() {
let a: Clam = Clam{x: box 1, y: box 2};
let b: Clam = Clam{x: box 10, y: box 20};
let z: isize = a.x + b.y;
//~^ ERROR binary operation `+` cannot be applied to type `std::boxed::Box<isize>`
//~^ ERROR cannot add `std::boxed::Box<isize>` to `std::boxed::Box<isize>`
println!("{}", z);
assert_eq!(z, 21);
let forty: Fish = Fish{a: box 40};
let two: Fish = Fish{a: box 2};
let answer: isize = forty.a + two.a;
//~^ ERROR binary operation `+` cannot be applied to type `std::boxed::Box<isize>`
//~^ ERROR cannot add `std::boxed::Box<isize>` to `std::boxed::Box<isize>`
println!("{}", answer);
assert_eq!(answer, 42);
}
2 changes: 1 addition & 1 deletion src/test/ui/binary-op-on-double-ref.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ fn main() {
let v = vec![1, 2, 3, 4, 5, 6, 7, 8, 9];
let vr = v.iter().filter(|x| {
x % 2 == 0
//~^ ERROR binary operation `%` cannot be applied to type `&&{integer}`
//~^ ERROR cannot mod `&&{integer}` by `{integer}`
});
println!("{:?}", vr);
}
2 changes: 1 addition & 1 deletion src/test/ui/binop/binop-bitxor-str.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
// error-pattern:`^` cannot be applied to type `std::string::String`
// error-pattern:no implementation for `std::string::String ^ std::string::String`

fn main() { let x = "a".to_string() ^ "b".to_string(); }
2 changes: 1 addition & 1 deletion src/test/ui/binop/binop-mul-bool.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
// error-pattern:`*` cannot be applied to type `bool`
// error-pattern:cannot multiply `bool` to `bool`

fn main() { let x = true * false; }
2 changes: 1 addition & 1 deletion src/test/ui/binop/binop-typeck.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ fn main() {
let x = true;
let y = 1;
let z = x + y;
//~^ ERROR binary operation `+` cannot be applied to type `bool`
//~^ ERROR cannot add `{integer}` to `bool`
}
2 changes: 1 addition & 1 deletion src/test/ui/for/for-loop-type-error.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
pub fn main() {
let x = () + (); //~ ERROR binary operation
let x = () + (); //~ ERROR cannot add `()` to `()`

// this shouldn't have a flow-on error:
for _ in x {}
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/issues/issue-14915.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ fn main() {
let x: Box<isize> = box 0;

println!("{}", x + 1);
//~^ ERROR binary operation `+` cannot be applied to type `std::boxed::Box<isize>`
//~^ ERROR cannot add `{integer}` to `std::boxed::Box<isize>`
}
2 changes: 1 addition & 1 deletion src/test/ui/issues/issue-24363.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
fn main() {
1.create_a_type_error[ //~ `{integer}` is a primitive type and therefore doesn't have fields
()+() //~ ERROR binary operation `+` cannot be applied
()+() //~ ERROR cannot add
// ^ ensure that we typeck the inner expression ^
];
}
18 changes: 9 additions & 9 deletions src/test/ui/issues/issue-28837.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,23 @@ struct A;
fn main() {
let a = A;

a + a; //~ ERROR binary operation `+` cannot be applied to type `A`
a + a; //~ ERROR cannot add `A` to `A`

a - a; //~ ERROR binary operation `-` cannot be applied to type `A`
a - a; //~ ERROR cannot substract `A` from `A`

a * a; //~ ERROR binary operation `*` cannot be applied to type `A`
a * a; //~ ERROR cannot multiply `A` to `A`

a / a; //~ ERROR binary operation `/` cannot be applied to type `A`
a / a; //~ ERROR cannot divide `A` by `A`

a % a; //~ ERROR binary operation `%` cannot be applied to type `A`
a % a; //~ ERROR cannot mod `A` by `A`

a & a; //~ ERROR binary operation `&` cannot be applied to type `A`
a & a; //~ ERROR no implementation for `A & A`

a | a; //~ ERROR binary operation `|` cannot be applied to type `A`
a | a; //~ ERROR no implementation for `A | A`

a << a; //~ ERROR binary operation `<<` cannot be applied to type `A`
a << a; //~ ERROR no implementation for `A << A`

a >> a; //~ ERROR binary operation `>>` cannot be applied to type `A`
a >> a; //~ ERROR no implementation for `A >> A`

a == a; //~ ERROR binary operation `==` cannot be applied to type `A`

Expand Down
4 changes: 2 additions & 2 deletions src/test/ui/issues/issue-31076.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ impl Add<i32> for i32 {}

fn main() {
let x = 5 + 6;
//~^ ERROR binary operation `+` cannot be applied to type `{integer}`
//~^ ERROR cannot add `{integer}` to `{integer}`
let y = 5i32 + 6i32;
//~^ ERROR binary operation `+` cannot be applied to type `i32`
//~^ ERROR cannot add `i32` to `i32`
}
2 changes: 1 addition & 1 deletion src/test/ui/issues/issue-35668.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
fn func<'a, T>(a: &'a [T]) -> impl Iterator<Item=&'a T> {
a.iter().map(|a| a*a)
//~^ ERROR binary operation `*` cannot be applied to type `&T`
//~^ ERROR cannot multiply `&T` to `&T`
}

fn main() {
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/issues/issue-3820.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,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 cannot multiply `{integer}` to `Thing`
}
2 changes: 1 addition & 1 deletion src/test/ui/issues/issue-40610.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ fn f(_: &[f32]) {}

fn main() {
() + f(&[1.0]);
//~^ ERROR binary operation `+` cannot be applied to type `()`
//~^ ERROR cannot add `()` to `()`
}
2 changes: 1 addition & 1 deletion src/test/ui/issues/issue-41394.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
enum Foo {
A = "" + 1
//~^ ERROR binary operation `+` cannot be applied to type `&str`
//~^ ERROR cannot add `{integer}` to `&str`
}

enum Bar {
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/or-patterns/or-patterns-syntactic-fail.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ use E::*;

fn no_top_level_or_patterns() {
// We do *not* allow or-patterns at the top level of lambdas...
let _ = |A | B: E| (); //~ ERROR binary operation `|` cannot be applied to type `E`
let _ = |A | B: E| (); //~ ERROR no implementation for `E | ()`
// -------- This looks like an or-pattern but is in fact `|A| (B: E | ())`.

// ...and for now neither do we allow or-patterns at the top level of functions.
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/pattern/pattern-tyvar-2.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
enum Bar { T1((), Option<Vec<isize>>), T2, }

fn foo(t: Bar) -> isize { match t { Bar::T1(_, Some(x)) => { return x * 3; } _ => { panic!(); } } }
//~^ ERROR binary operation `*` cannot be applied to
//~^ ERROR cannot multiply `{integer}` to `std::vec::Vec<isize>`

fn main() { }
26 changes: 13 additions & 13 deletions src/test/ui/span/issue-39018.rs
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
pub fn main() {
let x = "Hello " + "World!";
//~^ ERROR cannot be applied to type
//~^ ERROR cannot add

// Make sure that the span outputs a warning
// for not having an implementation for std::ops::Add
// that won't output for the above string concatenation
let y = World::Hello + World::Goodbye;
//~^ ERROR cannot be applied to type
//~^ ERROR cannot add

let x = "Hello " + "World!".to_owned();
//~^ ERROR cannot be applied to type
//~^ ERROR cannot add
}

enum World {
Expand All @@ -23,16 +23,16 @@ fn foo() {
let c = "";
let d = "";
let e = &a;
let _ = &a + &b; //~ ERROR binary operation
let _ = &a + b; //~ ERROR binary operation
let _ = &a + &b; //~ ERROR cannot add
let _ = &a + b; //~ ERROR cannot add
let _ = a + &b; // ok
let _ = a + b; //~ ERROR mismatched types
let _ = e + b; //~ ERROR binary operation
let _ = e + &b; //~ ERROR binary operation
let _ = e + d; //~ ERROR binary operation
let _ = e + &d; //~ ERROR binary operation
let _ = &c + &d; //~ ERROR binary operation
let _ = &c + d; //~ ERROR binary operation
let _ = c + &d; //~ ERROR binary operation
let _ = c + d; //~ ERROR binary operation
let _ = e + b; //~ ERROR cannot add
let _ = e + &b; //~ ERROR cannot add
let _ = e + d; //~ ERROR cannot add
let _ = e + &d; //~ ERROR cannot add
let _ = &c + &d; //~ ERROR cannot add
let _ = &c + d; //~ ERROR cannot add
let _ = c + &d; //~ ERROR cannot add
let _ = c + d; //~ ERROR cannot add
}
2 changes: 1 addition & 1 deletion src/test/ui/str/str-concat-on-double-ref.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ fn main() {
let a: &String = &"1".to_owned();
let b: &str = &"2";
let c = a + b;
//~^ ERROR binary operation `+` cannot be applied to type `&std::string::String`
//~^ ERROR cannot add `&str` to `&std::string::String`
println!("{:?}", c);
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
fn main() {
let unicode_is_fun = "؁‱ஹ௸௵꧄.ဪ꧅⸻𒈙𒐫﷽𒌄𒈟𒍼𒁎𒀱𒌧𒅃 𒈓𒍙𒊎𒄡𒅌𒁏𒀰𒐪𒐩𒈙𒐫𪚥";
let _ = "ༀ༁༂༃༄༅༆༇༈༉༊་༌།༎༏༐༑༒༓༔༕༖༗༘༙༚༛༜༝༞༟༠༡༢༣༤༥༦༧༨༩༪༫༬༭༮༯༰༱༲༳༴༵༶༷༸༹༺༻༼༽༾༿ཀཁགགྷངཅཆཇ཈ཉཊཋཌཌྷཎཏཐདདྷནཔཕབབྷམཙཚཛཛྷཝཞཟའཡརལཤཥསཧཨཀྵཪཫཬ཭཮཯཰ཱཱཱིིུུྲྀཷླྀཹེཻོཽཾཿ྄ཱྀྀྂྃ྅྆྇ྈྉྊྋྌྍྎྏྐྑྒྒྷྔྕྖྗ྘ྙྚྛྜྜྷྞྟྠྡྡྷྣྤྥྦྦྷྨྩྪྫྫྷྭྮྯྰྱྲླྴྵྶྷྸྐྵྺྻྼ྽྾྿࿀࿁࿂࿃࿄࿅࿆࿇࿈࿉࿊࿋࿌࿍࿎࿏࿐࿑࿒࿓࿔࿕࿖࿗࿘࿙࿚"; let _a = unicode_is_fun + " really fun!";
//~^ ERROR binary operation `+` cannot be applied to type `&str`
//~^ ERROR cannot add `&str` to `&str`
}
2 changes: 1 addition & 1 deletion src/test/ui/traits/trait-resolution-in-overloaded-op.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ trait MyMul<Rhs, Res> {
}

fn foo<T: MyMul<f64, f64>>(a: &T, b: f64) -> f64 {
a * b //~ ERROR binary operation `*` cannot be applied to type `&T`
a * b //~ ERROR cannot multiply `f64` to `&T`
}

fn main() {}
2 changes: 1 addition & 1 deletion src/test/ui/type/type-check/missing_trait_impl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ fn main() {
}

fn foo<T>(x: T, y: T) {
let z = x + y; //~ ERROR binary operation `+` cannot be applied to type `T`
let z = x + y; //~ ERROR cannot add `T` to `T`
}

fn bar<T>(x: T) {
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/vec/vec-res-add.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@ fn main() {
let i = vec![r(0)];
let j = vec![r(1)];
let k = i + j;
//~^ ERROR binary operation `+` cannot be applied to type
//~^ ERROR cannot add `std::vec::Vec<R>` to `std::vec::Vec<R>`
println!("{:?}", j);
}

0 comments on commit eac6fac

Please sign in to comment.