]>
git.proxmox.com Git - rustc.git/blob - src/test/ui/borrowck/borrowck-scope-of-deref-issue-4666.rs
2 // Tests that the scope of the pointer returned from `get()` is
3 // limited to the deref operation itself, and does not infect the
12 fn get(&self) -> &usize {
15 fn set(&mut self, x
: usize) {
21 // in the past, borrow checker behaved differently when
22 // init and decl of `v` were distinct
24 let mut a_box
= Box {x: 0}
;
28 assert_eq
!(23, *a_box
.get());
32 let mut a_box
= Box {x: 0}
;
36 assert_eq
!(23, *a_box
.get());