]> git.proxmox.com Git - rustc.git/blame - src/test/ui/issues/issue-17263.rs
New upstream version 1.49.0+dfsg1
[rustc.git] / src / test / ui / issues / issue-17263.rs
CommitLineData
d9bb1a4e 1// check-pass
1a4d82fc 2
48663c56 3#![feature(box_syntax)]
1a4d82fc
JJ
4
5struct Foo { a: isize, b: isize }
48663c56
XL
6
7fn main() {
c34b1796 8 let mut x: Box<_> = box Foo { a: 1, b: 2 };
1a4d82fc 9 let (a, b) = (&mut x.a, &mut x.b);
1a4d82fc 10
c34b1796 11 let mut foo: Box<_> = box Foo { a: 1, b: 2 };
1a4d82fc 12 let (c, d) = (&mut foo.a, &foo.b);
a1dfa0c6 13
48663c56
XL
14 // We explicitly use the references created above to illustrate that the
15 // borrow checker is accepting this code *not* because of artificially
a1dfa0c6
XL
16 // short lifetimes, but rather because it understands that all the
17 // references are of disjoint parts of memory.
18 use_imm(d);
19 use_mut(c);
20 use_mut(b);
21 use_mut(a);
1a4d82fc 22}
a1dfa0c6
XL
23
24fn use_mut<T>(_: &mut T) { }
25fn use_imm<T>(_: &T) { }