]> git.lizzy.rs Git - rust.git/blob - tests/ui/consts/const_let_assign2.rs
Auto merge of #106711 - albertlarsan68:use-ci-llvm-when-lld, r=jyn514
[rust.git] / tests / ui / consts / const_let_assign2.rs
1 // check-pass
2
3 pub struct AA {
4     pub data: [u8; 10],
5 }
6
7 impl AA {
8     pub const fn new() -> Self {
9         let mut res: AA = AA { data: [0; 10] };
10         res.data[0] = 5;
11         res
12     }
13 }
14
15 static mut BB: AA = AA::new();
16
17 fn main() {
18     let ptr = unsafe { &mut BB };
19     for a in ptr.data.iter() {
20         println!("{}", a);
21     }
22 }