rust/src/test/run-pass/issue-2288.rs

46 lines
925 B
Rust
Raw Normal View History

// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
// pretty-expanded FIXME #23616
#![allow(unknown_features)]
#![feature(box_syntax)]
trait clam<A> {
fn chowder(&self, y: A);
2012-07-13 14:44:48 -07:00
}
2015-01-24 16:36:30 -05:00
#[derive(Copy)]
struct foo<A> {
2012-09-06 19:40:15 -07:00
x: A,
}
impl<A> clam<A> for foo<A> {
2013-08-17 08:37:42 -07:00
fn chowder(&self, _y: A) {
2012-07-13 14:44:48 -07:00
}
}
fn foo<A>(b: A) -> foo<A> {
2012-09-05 15:58:43 -07:00
foo {
x: b
}
}
fn f<A>(x: Box<clam<A>>, a: A) {
2012-07-13 14:44:48 -07:00
x.chowder(a);
}
pub fn main() {
2012-07-13 14:44:48 -07:00
let c = foo(42);
let d: Box<clam<isize>> = box c as Box<clam<isize>>;
2012-07-13 14:44:48 -07:00
f(d, c.x);
}