]> git.lizzy.rs Git - rust.git/blob - src/test/ui/issues/issue-2288.rs
Rollup merge of #100030 - WaffleLapkin:nice_pointer_sis, r=scottmcm
[rust.git] / src / test / ui / issues / issue-2288.rs
1 // run-pass
2 #![allow(non_camel_case_types)]
3
4 trait clam<A> {
5   fn chowder(&self, y: A);
6 }
7
8 #[derive(Copy, Clone)]
9 struct foo<A> {
10   x: A,
11 }
12
13 impl<A> clam<A> for foo<A> {
14   fn chowder(&self, _y: A) {
15   }
16 }
17
18 fn foo<A>(b: A) -> foo<A> {
19     foo {
20         x: b
21     }
22 }
23
24 fn f<A>(x: Box<dyn clam<A>>, a: A) {
25   x.chowder(a);
26 }
27
28 pub fn main() {
29
30   let c = foo(42);
31   let d: Box<dyn clam<isize>> = Box::new(c) as Box<dyn clam<isize>>;
32   f(d, c.x);
33 }