2017-01-14 14:25:33 -06:00
|
|
|
pub fn main() {
|
|
|
|
let x = "Hello " + "World!";
|
2019-12-11 16:11:32 -06:00
|
|
|
//~^ ERROR cannot add
|
2017-01-14 14:25:33 -06:00
|
|
|
|
|
|
|
// 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;
|
2019-12-11 16:11:32 -06:00
|
|
|
//~^ ERROR cannot add
|
2018-02-21 00:46:51 -06:00
|
|
|
|
|
|
|
let x = "Hello " + "World!".to_owned();
|
2019-12-11 16:11:32 -06:00
|
|
|
//~^ ERROR cannot add
|
2017-01-14 14:25:33 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
enum World {
|
|
|
|
Hello,
|
|
|
|
Goodbye,
|
|
|
|
}
|
2019-05-16 21:29:02 -05:00
|
|
|
|
|
|
|
fn foo() {
|
|
|
|
let a = String::new();
|
|
|
|
let b = String::new();
|
|
|
|
let c = "";
|
|
|
|
let d = "";
|
|
|
|
let e = &a;
|
2019-12-11 16:11:32 -06:00
|
|
|
let _ = &a + &b; //~ ERROR cannot add
|
|
|
|
let _ = &a + b; //~ ERROR cannot add
|
2019-05-16 21:29:02 -05:00
|
|
|
let _ = a + &b; // ok
|
|
|
|
let _ = a + b; //~ ERROR mismatched types
|
2019-12-11 16:11:32 -06:00
|
|
|
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
|
2019-05-16 21:29:02 -05:00
|
|
|
}
|