]> git.lizzy.rs Git - rust.git/blob - tests/ui/borrowck/borrowck-uninit-ref-chain.rs
Rollup merge of #106726 - cmorin6:fix-comment-typos, r=Nilstrieb
[rust.git] / tests / ui / borrowck / borrowck-uninit-ref-chain.rs
1 struct S<X, Y> {
2     x: X,
3     y: Y,
4 }
5
6 fn main() {
7     let x: &&Box<i32>;
8     let _y = &**x; //~ ERROR [E0381]
9
10     let x: &&S<i32, i32>;
11     let _y = &**x; //~ ERROR [E0381]
12
13     let x: &&i32;
14     let _y = &**x; //~ ERROR [E0381]
15
16
17     let mut a: S<i32, i32>;
18     a.x = 0; //~ ERROR [E0381]
19     let _b = &a.x;
20
21     let mut a: S<&&i32, &&i32>;
22     a.x = &&0; //~ ERROR [E0381]
23     let _b = &**a.x;
24
25
26     let mut a: S<i32, i32>;
27     a.x = 0; //~ ERROR [E0381]
28     let _b = &a.y;
29
30     let mut a: S<&&i32, &&i32>;
31     a.x = &&0; //~ ERROR [E0381]
32     let _b = &**a.y;
33 }