// Copyright 2014 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 or the MIT license // , at your // option. This file may not be copied, modified, or distributed // except according to those terms. // Check that coercions unify the expected return type of a polymorphic // function call, instead of leaving the type variables as they were. struct Foo; impl Foo { fn foo(self, x: T) -> Option { Some(x) } } pub fn main() { let _: Option = Some(main); let _: Option = Foo.foo(main); // The same two cases, with implicit type variables made explicit. let _: Option = Some::<_>(main); let _: Option = Foo.foo::<_>(main); }