]> git.lizzy.rs Git - rust.git/blob - src/test/ui/issues/issue-36036-associated-type-layout.rs
Add 'src/tools/clippy/' from commit 'd2708873ef711ec8ab45df1e984ecf24a96cd369'
[rust.git] / src / test / ui / issues / issue-36036-associated-type-layout.rs
1 // run-pass
2 // Issue 36036: computing the layout of a type composed from another
3 // trait's associated type caused compiler to ICE when the associated
4 // type was allowed to be unsized, even though the known instantiated
5 // type is itself sized.
6
7 #![allow(dead_code)]
8
9 trait Context {
10     type Container: ?Sized;
11 }
12
13 impl Context for u16 {
14     type Container = u8;
15 }
16
17 struct Wrapper<C: Context+'static> {
18     container: &'static C::Container
19 }
20
21 fn foobar(_: Wrapper<u16>) {}
22
23 static VALUE: u8 = 0;
24
25 fn main() {
26     foobar(Wrapper { container: &VALUE });
27 }