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