]> git.lizzy.rs Git - rust.git/blob - src/test/ui/alignment-gep-tup-like-1.rs
Auto merge of #75936 - sdroege:chunks-exact-construction-bounds-check, r=nagisa
[rust.git] / src / test / ui / alignment-gep-tup-like-1.rs
1 // run-pass
2
3 #![allow(non_camel_case_types)]
4 #![allow(dead_code)]
5
6 #![feature(box_syntax)]
7
8 struct pair<A,B> {
9     a: A, b: B
10 }
11
12 trait Invokable<A> {
13     fn f(&self) -> (A, u16);
14 }
15
16 struct Invoker<A> {
17     a: A,
18     b: u16,
19 }
20
21 impl<A:Clone> Invokable<A> for Invoker<A> {
22     fn f(&self) -> (A, u16) {
23         (self.a.clone(), self.b)
24     }
25 }
26
27 fn f<A:Clone + 'static>(a: A, b: u16) -> Box<dyn Invokable<A>+'static> {
28     box Invoker {
29         a: a,
30         b: b,
31     } as Box<dyn Invokable<A>+'static>
32 }
33
34 pub fn main() {
35     let (a, b) = f(22_u64, 44u16).f();
36     println!("a={} b={}", a, b);
37     assert_eq!(a, 22u64);
38     assert_eq!(b, 44u16);
39 }