]> git.proxmox.com Git - rustc.git/blob - src/test/ui/run-pass/issues/issue-29147.rs
New upstream version 1.30.0+dfsg1
[rustc.git] / src / test / ui / run-pass / issues / issue-29147.rs
1 // Copyright 2015 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution and at
3 // http://rust-lang.org/COPYRIGHT.
4 //
5 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8 // option. This file may not be copied, modified, or distributed
9 // except according to those terms.
10
11 // run-pass
12 #![recursion_limit="1024"]
13
14 use std::mem;
15
16 pub struct S0<T>(T,T);
17 pub struct S1<T>(Option<Box<S0<S0<T>>>>,Option<Box<S0<S0<T>>>>);
18 pub struct S2<T>(Option<Box<S1<S1<T>>>>,Option<Box<S1<S1<T>>>>);
19 pub struct S3<T>(Option<Box<S2<S2<T>>>>,Option<Box<S2<S2<T>>>>);
20 pub struct S4<T>(Option<Box<S3<S3<T>>>>,Option<Box<S3<S3<T>>>>);
21 pub struct S5<T>(Option<Box<S4<S4<T>>>>,Option<Box<S4<S4<T>>>>,Option<T>);
22
23 trait Foo { fn xxx(&self); }
24 /// some local of #[fundamental] trait
25 trait Bar {}
26
27 impl<T> Foo for T where T: Bar, T: Sync {
28 fn xxx(&self) {}
29 }
30
31 impl Foo for S5<u8> { fn xxx(&self) {} }
32
33 fn main() {
34 let s = S5(None,None,None);
35 s.xxx();
36 assert_eq!(mem::size_of_val(&s.2), mem::size_of::<Option<u8>>());
37 }