]> git.proxmox.com Git - rustc.git/blob - tests/ui/issues/issue-5688.rs
New upstream version 1.68.2+dfsg1
[rustc.git] / tests / ui / issues / issue-5688.rs
1 // run-pass
2 /*
3 # Corrupted initialization in the static struct
4
5 ...should print &[1, 2, 3] but instead prints something like
6 &[4492532864, 24]. It is pretty evident that the compiler messed up
7 with the representation of [isize; n] and [isize] somehow, or at least
8 failed to typecheck correctly.
9 */
10
11 #[derive(Copy, Clone)]
12 struct X { vec: &'static [isize] }
13
14 static V: &'static [X] = &[X { vec: &[1, 2, 3] }];
15
16 pub fn main() {
17 for &v in V {
18 println!("{:?}", v.vec);
19 }
20 }