]> git.lizzy.rs Git - rust.git/blob - tests/ui/borrowck/borrowck-uniq-via-ref.rs
Rollup merge of #106726 - cmorin6:fix-comment-typos, r=Nilstrieb
[rust.git] / tests / ui / borrowck / borrowck-uniq-via-ref.rs
1 // run-pass
2 #![allow(dead_code)]
3
4 // pretty-expanded FIXME #23616
5
6 struct Rec {
7     f: Box<isize>,
8 }
9
10 struct Outer {
11     f: Inner
12 }
13
14 struct Inner {
15     g: Innermost
16 }
17
18 struct Innermost {
19     h: Box<isize>,
20 }
21
22 fn borrow(_v: &isize) {}
23
24 fn box_mut(v: &mut Box<isize>) {
25     borrow(&**v); // OK: &mut -> &imm
26 }
27
28 fn box_mut_rec(v: &mut Rec) {
29     borrow(&*v.f); // OK: &mut -> &imm
30 }
31
32 fn box_mut_recs(v: &mut Outer) {
33     borrow(&*v.f.g.h); // OK: &mut -> &imm
34 }
35
36 fn box_imm(v: &Box<isize>) {
37     borrow(&**v); // OK
38 }
39
40 fn box_imm_rec(v: &Rec) {
41     borrow(&*v.f); // OK
42 }
43
44 fn box_imm_recs(v: &Outer) {
45     borrow(&*v.f.g.h); // OK
46 }
47
48 pub fn main() {
49 }