]> git.lizzy.rs Git - rust.git/blob - src/test/ui/dst/dst-bad-deep.rs
Auto merge of #75936 - sdroege:chunks-exact-construction-bounds-check, r=nagisa
[rust.git] / src / test / ui / dst / dst-bad-deep.rs
1 // Try to initialise a DST struct where the lost information is deeply nested.
2 // This is an error because it requires an unsized rvalue. This is a problem
3 // because it would require stack allocation of an unsized temporary (*g in the
4 // test).
5
6 struct Fat<T: ?Sized> {
7     ptr: T
8 }
9
10 pub fn main() {
11     let f: Fat<[isize; 3]> = Fat { ptr: [5, 6, 7] };
12     let g: &Fat<[isize]> = &f;
13     let h: &Fat<Fat<[isize]>> = &Fat { ptr: *g };
14     //~^ ERROR the size for values of type
15 }