summaryrefslogtreecommitdiffstats
path: root/src/test/ui/type-alias-impl-trait/closures_in_branches.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/ui/type-alias-impl-trait/closures_in_branches.rs')
-rw-r--r--src/test/ui/type-alias-impl-trait/closures_in_branches.rs31
1 files changed, 31 insertions, 0 deletions
diff --git a/src/test/ui/type-alias-impl-trait/closures_in_branches.rs b/src/test/ui/type-alias-impl-trait/closures_in_branches.rs
new file mode 100644
index 000000000..7bb490bbe
--- /dev/null
+++ b/src/test/ui/type-alias-impl-trait/closures_in_branches.rs
@@ -0,0 +1,31 @@
+#![feature(type_alias_impl_trait)]
+
+type Foo = impl std::ops::FnOnce(String) -> usize;
+
+fn foo(b: bool) -> Foo {
+ if b {
+ |x| x.len() //~ ERROR type annotations needed
+ } else {
+ panic!()
+ }
+}
+
+
+type Foo1 = impl std::ops::FnOnce(String) -> usize;
+fn foo1(b: bool) -> Foo1 {
+ |x| x.len()
+}
+
+fn bar(b: bool) -> impl std::ops::FnOnce(String) -> usize {
+ if b {
+ |x| x.len() //~ ERROR type annotations needed
+ } else {
+ panic!()
+ }
+}
+
+fn bar1(b: bool) -> impl std::ops::FnOnce(String) -> usize {
+ |x| x.len()
+}
+
+fn main() {}