]> git.lizzy.rs Git - rust.git/blob - src/test/ui/span/issue-39018.rs
Rollup merge of #87922 - Manishearth:c-enum-target-spec, r=nagisa,eddyb
[rust.git] / src / test / ui / span / issue-39018.rs
1 pub fn main() {
2     let x = "Hello " + "World!";
3     //~^ ERROR cannot add
4
5     // Make sure that the span outputs a warning
6     // for not having an implementation for std::ops::Add
7     // that won't output for the above string concatenation
8     let y = World::Hello + World::Goodbye;
9     //~^ ERROR cannot add
10
11     let x = "Hello " + "World!".to_owned();
12     //~^ ERROR cannot add
13 }
14
15 enum World {
16     Hello,
17     Goodbye,
18 }
19
20 fn foo() {
21     let a = String::new();
22     let b = String::new();
23     let c = "";
24     let d = "";
25     let e = &a;
26     let _ = &a + &b; //~ ERROR cannot add
27     let _ = &a + b; //~ ERROR cannot add
28     let _ = a + &b; // ok
29     let _ = a + b; //~ ERROR mismatched types
30     let _ = e + b; //~ ERROR cannot add
31     let _ = e + &b; //~ ERROR cannot add
32     let _ = e + d; //~ ERROR cannot add
33     let _ = e + &d; //~ ERROR cannot add
34     let _ = &c + &d; //~ ERROR cannot add
35     let _ = &c + d; //~ ERROR cannot add
36     let _ = c + &d; //~ ERROR cannot add
37     let _ = c + d; //~ ERROR cannot add
38 }