]> git.lizzy.rs Git - rust.git/blob - src/test/ui/coercion/coerce-unify-return.rs
Rollup merge of #100112 - RalfJung:assert_send_and_sync, r=m-ou-se
[rust.git] / src / test / ui / coercion / coerce-unify-return.rs
1 // run-pass
2 // Check that coercions unify the expected return type of a polymorphic
3 // function call, instead of leaving the type variables as they were.
4
5 // pretty-expanded FIXME #23616
6
7 struct Foo;
8 impl Foo {
9     fn foo<T>(self, x: T) -> Option<T> { Some(x) }
10 }
11
12 pub fn main() {
13     let _: Option<fn()> = Some(main);
14     let _: Option<fn()> = Foo.foo(main);
15
16     // The same two cases, with implicit type variables made explicit.
17     let _: Option<fn()> = Some::<_>(main);
18     let _: Option<fn()> = Foo.foo::<_>(main);
19 }