From 906c52743aa60002abadae2a9f19673bdad3cf80 Mon Sep 17 00:00:00 2001 From: b-naber Date: Wed, 2 Nov 2022 13:49:42 +0100 Subject: [PATCH] add tests --- src/test/ui/mir/field-ty-ascription.rs | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 src/test/ui/mir/field-ty-ascription.rs diff --git a/src/test/ui/mir/field-ty-ascription.rs b/src/test/ui/mir/field-ty-ascription.rs new file mode 100644 index 00000000000..4147f05776a --- /dev/null +++ b/src/test/ui/mir/field-ty-ascription.rs @@ -0,0 +1,21 @@ +// build-pass + +struct Foo(T); // `T` is covariant. + +fn foo<'b>(x: Foo fn(&'a ())>) { + let Foo(y): Foo = x; +} + +fn foo_nested<'b>(x: Foo fn(&'a ())>>) { + let Foo(Foo(y)): Foo> = x; +} + +fn tuple<'b>(x: (u32, for<'a> fn(&'a ()))) { + let (_, y): (u32, fn(&'b ())) = x; +} + +fn tuple_nested<'b>(x: (u32, (u32, for<'a> fn(&'a ())))) { + let (_, (_, y)): (u32, (u32, fn(&'b ()))) = x; +} + +fn main() {}