]>
Commit | Line | Data |
---|---|---|
416331ca XL |
1 | // run-pass |
2 | ||
c34b1796 | 3 | #[derive(Copy, Clone)] |
1a4d82fc | 4 | pub struct Foo { |
c34b1796 AL |
5 | f1: isize, |
6 | _f2: isize, | |
223e47cc LB |
7 | } |
8 | ||
1a4d82fc JJ |
9 | #[inline(never)] |
10 | pub fn foo(f: &mut Foo) -> Foo { | |
11 | let ret = *f; | |
12 | f.f1 = 0; | |
13 | ret | |
223e47cc LB |
14 | } |
15 | ||
16 | pub fn main() { | |
1a4d82fc JJ |
17 | let mut f = Foo { |
18 | f1: 8, | |
19 | _f2: 9, | |
223e47cc | 20 | }; |
1a4d82fc JJ |
21 | f = foo(&mut f); |
22 | assert_eq!(f.f1, 8); | |
223e47cc | 23 | } |