diff options
| author | b-naber <bn263@gmx.de> | 2022-11-02 22:05:19 +0100 |
|---|---|---|
| committer | b-naber <bn263@gmx.de> | 2022-11-23 20:01:15 +0100 |
| commit | 2ef8308687f57335e117fdfa7d92002cf6f53eda (patch) | |
| tree | d7351145138c5f921512f54048f94a805f664c2a /src | |
| parent | f015842ed2094340ac1cce2cc4b559eca98e3371 (diff) | |
| download | rust-2ef8308687f57335e117fdfa7d92002cf6f53eda.tar.gz rust-2ef8308687f57335e117fdfa7d92002cf6f53eda.zip | |
add more tests
Diffstat (limited to 'src')
| -rw-r--r-- | src/test/ui/mir/field-ty-ascription-enums.rs | 15 | ||||
| -rw-r--r-- | src/test/ui/mir/field-ty-ascription.rs | 16 |
2 files changed, 31 insertions, 0 deletions
diff --git a/src/test/ui/mir/field-ty-ascription-enums.rs b/src/test/ui/mir/field-ty-ascription-enums.rs new file mode 100644 index 00000000000..179af617090 --- /dev/null +++ b/src/test/ui/mir/field-ty-ascription-enums.rs @@ -0,0 +1,15 @@ +// build-pass + +enum Foo<T> { + Var(T), +} // `T` is covariant. + +fn foo<'b>(x: Foo<for<'a> fn(&'a ())>) { + let Foo::Var(x): Foo<fn(&'b ())> = x; +} + +fn foo_nested<'b>(x: Foo<Foo<for<'a> fn(&'a ())>>) { + let Foo::Var(Foo::Var(x)): Foo<Foo<fn(&'b ())>> = x; +} + +fn main() {} diff --git a/src/test/ui/mir/field-ty-ascription.rs b/src/test/ui/mir/field-ty-ascription.rs index 4147f05776a..178c7916bc5 100644 --- a/src/test/ui/mir/field-ty-ascription.rs +++ b/src/test/ui/mir/field-ty-ascription.rs @@ -2,6 +2,22 @@ struct Foo<T>(T); // `T` is covariant. +struct Bar<T> { + x: T, +} // `T` is covariant. + +fn bar<'b>(x: Bar<for<'a> fn(&'a ())>) { + let Bar { x }: Bar<fn(&'b ())> = x; +} + +fn bar_nested<'b>(x: Bar<Bar<for<'a> fn(&'a ())>>) { + let Bar { x: Bar { x } }: Bar<Bar<fn(&'b ())>> = x; +} + +fn bar_foo_nested<'b>(x: Bar<Foo<for<'a> fn(&'a ())>>) { + let Bar { x: Foo ( x ) }: Bar<Foo<fn(&'b ())>> = x; +} + fn foo<'b>(x: Foo<for<'a> fn(&'a ())>) { let Foo(y): Foo<fn(&'b ())> = x; } |
