about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--tests/ui/type-alias-impl-trait/nested_in_closure.rs10
-rw-r--r--tests/ui/type-alias-impl-trait/nested_in_closure.stderr28
2 files changed, 38 insertions, 0 deletions
diff --git a/tests/ui/type-alias-impl-trait/nested_in_closure.rs b/tests/ui/type-alias-impl-trait/nested_in_closure.rs
new file mode 100644
index 00000000000..3e9453559d5
--- /dev/null
+++ b/tests/ui/type-alias-impl-trait/nested_in_closure.rs
@@ -0,0 +1,10 @@
+#![feature(type_alias_impl_trait)]
+
+fn main() {
+    let x = || {
+        type Tait = impl Sized;
+        let y: Tait = ();
+        //~^ ERROR: item constrains opaque type that is not in its signature
+        //~| ERROR: item constrains opaque type that is not in its signature
+    };
+}
diff --git a/tests/ui/type-alias-impl-trait/nested_in_closure.stderr b/tests/ui/type-alias-impl-trait/nested_in_closure.stderr
new file mode 100644
index 00000000000..c2e584793ad
--- /dev/null
+++ b/tests/ui/type-alias-impl-trait/nested_in_closure.stderr
@@ -0,0 +1,28 @@
+error: item constrains opaque type that is not in its signature
+  --> $DIR/nested_in_closure.rs:6:23
+   |
+LL |         let y: Tait = ();
+   |                       ^^
+   |
+   = note: this item must have the opaque type in its signature in order to be able to register hidden types
+note: this item must have the opaque type in its signature in order to be able to register hidden types
+  --> $DIR/nested_in_closure.rs:3:4
+   |
+LL | fn main() {
+   |    ^^^^
+
+error: item constrains opaque type that is not in its signature
+  --> $DIR/nested_in_closure.rs:6:23
+   |
+LL |         let y: Tait = ();
+   |                       ^^
+   |
+   = note: this item must have the opaque type in its signature in order to be able to register hidden types
+note: this item must have the opaque type in its signature in order to be able to register hidden types
+  --> $DIR/nested_in_closure.rs:4:13
+   |
+LL |     let x = || {
+   |             ^^
+
+error: aborting due to 2 previous errors
+