about summary refs log tree commit diff
path: root/tests/ui/function-pointer/unsized-ret.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/function-pointer/unsized-ret.rs')
-rw-r--r--tests/ui/function-pointer/unsized-ret.rs15
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/ui/function-pointer/unsized-ret.rs b/tests/ui/function-pointer/unsized-ret.rs
new file mode 100644
index 00000000000..79009c5cb6c
--- /dev/null
+++ b/tests/ui/function-pointer/unsized-ret.rs
@@ -0,0 +1,15 @@
+#![feature(fn_traits)]
+#![feature(unboxed_closures)]
+#![feature(tuple_trait)]
+
+fn foo<F: Fn<T>, T:std::marker::Tuple>(f: Option<F>, t: T) {
+    let y = (f.unwrap()).call(t);
+}
+
+fn main() {
+    foo::<fn() -> str, _>(None, ());
+    //~^ ERROR the size for values of type `str` cannot be known at compilation time
+
+    foo::<for<'a> fn(&'a ()) -> (dyn std::fmt::Display + 'a), _>(None, (&(),));
+    //~^ ERROR the size for values of type `(dyn std::fmt::Display + 'a)` cannot be known at compilation time
+}