rust/src/test/run-pass/early-vtbl-resolution.rs

18 lines
311 B
Rust
Raw Normal View History

trait thing<A> {
2012-08-20 14:23:37 -05:00
fn foo() -> Option<A>;
}
impl<A> int: thing<A> {
2012-08-20 14:23:37 -05:00
fn foo() -> Option<A> { None }
}
2012-08-20 14:23:37 -05:00
fn foo_func<A, B: thing<A>>(x: B) -> Option<A> { x.foo() }
fn main() {
2012-09-25 19:39:22 -05:00
for iter::eachi(&(Some({a: 0}))) |i, a| {
debug!("%u %d", i, a.a);
}
2012-08-20 14:23:37 -05:00
let _x: Option<float> = foo_func(0);
}