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() {}