]> git.proxmox.com Git - rustc.git/blame - src/test/ui/issues/issue-36278-prefix-nesting.rs
Update unsuspicious file list
[rustc.git] / src / test / ui / issues / issue-36278-prefix-nesting.rs
CommitLineData
b7449926 1// run-pass
9e0c209e
SL
2// Issue 36278: On an unsized struct with >1 level of nontrivial
3// nesting, ensure we are computing dynamic size of prefix correctly.
4
5use std::mem;
6
7const SZ: usize = 100;
064997fb 8#[allow(unused_tuple_struct_fields)]
9e0c209e
SL
9struct P<T: ?Sized>([u8; SZ], T);
10
11type Ack<T> = P<P<T>>;
12
13fn main() {
14 let size_of_sized; let size_of_unsized;
15 let x: Box<Ack<[u8; 0]>> = Box::new(P([0; SZ], P([0; SZ], [0; 0])));
16 size_of_sized = mem::size_of_val::<Ack<_>>(&x);
17 let y: Box<Ack<[u8 ]>> = x;
18 size_of_unsized = mem::size_of_val::<Ack<_>>(&y);
19 assert_eq!(size_of_sized, size_of_unsized);
20}