]> git.lizzy.rs Git - rust.git/blob - src/test/ui/packed/packed-with-inference-vars-issue-61402.rs
Rollup merge of #95534 - jyn514:std-mem-copy, r=joshtriplett
[rust.git] / src / test / ui / packed / packed-with-inference-vars-issue-61402.rs
1 // run-pass
2 // If a struct is packed and its last field has drop glue, then that
3 // field needs to be Sized (to allow it to be destroyed out-of-place).
4 //
5 // This is checked by the compiler during wfcheck. That check used
6 // to have problems with associated types in the last field - test
7 // that this doesn't ICE.
8
9 #![allow(unused_imports, dead_code)]
10
11 pub struct S;
12
13 pub trait Trait<R> { type Assoc; }
14
15 impl<X> Trait<X> for S { type Assoc = X; }
16
17 #[repr(C, packed)]
18 struct PackedAssocSized {
19     pos: Box<<S as Trait<usize>>::Assoc>,
20 }
21
22 fn main() { println!("Hello, world!"); }