From ef52dc7bb8c14c5663773f70e1353fd53131261c Mon Sep 17 00:00:00 2001 From: Oli Scherer Date: Thu, 29 Jun 2023 07:47:29 +0000 Subject: [PATCH] Add regression test --- .../nested_in_closure.rs | 10 +++++++ .../nested_in_closure.stderr | 28 +++++++++++++++++++ 2 files changed, 38 insertions(+) create mode 100644 tests/ui/type-alias-impl-trait/nested_in_closure.rs create mode 100644 tests/ui/type-alias-impl-trait/nested_in_closure.stderr 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 +