]> git.lizzy.rs Git - rust.git/blob - src/test/ui/autoderef-full-lval.rs
Auto merge of #98051 - davidtwco:split-dwarf-stabilization, r=wesleywiser
[rust.git] / src / test / ui / autoderef-full-lval.rs
1 struct Clam {
2     x: Box<isize>,
3     y: Box<isize>,
4 }
5
6
7
8 struct Fish {
9     a: Box<isize>,
10 }
11
12 fn main() {
13     let a: Clam = Clam{ x: Box::new(1), y: Box::new(2) };
14     let b: Clam = Clam{ x: Box::new(10), y: Box::new(20) };
15     let z: isize = a.x + b.y;
16     //~^ ERROR cannot add `Box<isize>` to `Box<isize>`
17     println!("{}", z);
18     assert_eq!(z, 21);
19     let forty: Fish = Fish{ a: Box::new(40) };
20     let two: Fish = Fish{ a: Box::new(2) };
21     let answer: isize = forty.a + two.a;
22     //~^ ERROR cannot add `Box<isize>` to `Box<isize>`
23     println!("{}", answer);
24     assert_eq!(answer, 42);
25 }