trait bar { fn get_bar() -> T; } fn foo>(b: U) -> T { b.get_bar() } struct cbar : bar { x: int, fn get_bar() -> int { self.x } } fn cbar(x: int) -> cbar { cbar { x: x } } fn main() { let x: int = foo::(cbar(5)); assert x == 5; }