]> git.lizzy.rs Git - rust.git/blob - src/test/ui/issues/issue-5688.rs
Rollup merge of #66350 - hermitcore:hermit, r=rkruppe
[rust.git] / src / test / 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 }