rust/tests/ui/issues/issue-2288.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

34 lines
442 B
Rust
Raw Normal View History

// run-pass
#![allow(non_camel_case_types)]
trait clam<A> {
fn chowder(&self, y: A);
2012-07-13 21:44:48 +00:00
}
2015-03-30 13:38:27 +00:00
#[derive(Copy, Clone)]
struct foo<A> {
2012-09-07 02:40:15 +00:00
x: A,
}
impl<A> clam<A> for foo<A> {
2013-08-17 15:37:42 +00:00
fn chowder(&self, _y: A) {
2012-07-13 21:44:48 +00:00
}
}
fn foo<A>(b: A) -> foo<A> {
2012-09-05 22:58:43 +00:00
foo {
x: b
}
}
2019-05-28 18:47:21 +00:00
fn f<A>(x: Box<dyn clam<A>>, a: A) {
2012-07-13 21:44:48 +00:00
x.chowder(a);
}
pub fn main() {
2012-07-13 21:44:48 +00:00
let c = foo(42);
let d: Box<dyn clam<isize>> = Box::new(c) as Box<dyn clam<isize>>;
2012-07-13 21:44:48 +00:00
f(d, c.x);
}