diff options
Diffstat (limited to '')
-rw-r--r-- | src/test/ui/function-pointer/unsized-ret.rs | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/test/ui/function-pointer/unsized-ret.rs b/src/test/ui/function-pointer/unsized-ret.rs new file mode 100644 index 000000000..60af5769d --- /dev/null +++ b/src/test/ui/function-pointer/unsized-ret.rs @@ -0,0 +1,14 @@ +#![feature(fn_traits)] +#![feature(unboxed_closures)] + +fn foo<F: Fn<T>, T>(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 +} |