about summary refs log tree commit diff
diff options
context:
space:
mode:
authorChristian Poveda <z1mvader@protonmail.com>2017-05-08 16:34:29 -0500
committerChristian Poveda <z1mvader@protonmail.com>2017-05-08 16:34:29 -0500
commit78b27373dced7ec5bb1243982271cda9f1079693 (patch)
tree26f984d32bb009f35ecb49baf16a7f4d4c00bf7d
parent8aaae945eaf929cc277cfb5705e8d6d280e2a102 (diff)
downloadrust-78b27373dced7ec5bb1243982271cda9f1079693.tar.gz
rust-78b27373dced7ec5bb1243982271cda9f1079693.zip
added test
-rw-r--r--src/test/run-pass/closure_to_fn_coercion-expected-types.rs18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/test/run-pass/closure_to_fn_coercion-expected-types.rs b/src/test/run-pass/closure_to_fn_coercion-expected-types.rs
new file mode 100644
index 00000000000..7d951c655ca
--- /dev/null
+++ b/src/test/run-pass/closure_to_fn_coercion-expected-types.rs
@@ -0,0 +1,18 @@
+// 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.
+//
+// Ensure that we deduce expected argument types when a `fn()` type is expected (#41755)
+
+#![feature(closure_to_fn_coercion)]
+fn foo(f: fn(Vec<u32>) -> usize) { }
+
+fn main() {
+    foo(|x| x.len())
+}