diff options
| author | b-naber <bn263@gmx.de> | 2022-11-22 22:08:09 +0100 |
|---|---|---|
| committer | b-naber <bn263@gmx.de> | 2022-11-23 20:55:17 +0100 |
| commit | 4d00026edd315a05c4aff27c8d8cb233a6e95d92 (patch) | |
| tree | 73fcda13f0604caad2873b2cb8a2510fa58ffbef | |
| parent | 4040734e44d72697dbeb35c4c1be1a70cb7b0b37 (diff) | |
add invariance test
| -rw-r--r-- | src/test/ui/mir/field-projection-invariant.rs | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/src/test/ui/mir/field-projection-invariant.rs b/src/test/ui/mir/field-projection-invariant.rs new file mode 100644 index 00000000000..b5d6add043c --- /dev/null +++ b/src/test/ui/mir/field-projection-invariant.rs @@ -0,0 +1,24 @@ +// build-pass +struct Inv<'a>(&'a mut &'a ()); +enum Foo<T> { + Bar, + Var(T), +} +type Supertype = Foo<for<'a> fn(Inv<'a>, Inv<'a>)>; + +fn foo(x: Foo<for<'a, 'b> fn(Inv<'a>, Inv<'b>)>) { + match x { + Supertype::Bar => {} + Supertype::Var(x) => {} + } +} + +fn foo_nested(x: Foo<Foo<for<'a, 'b> fn(Inv<'a>, Inv<'b>)>>) { + match x { + Foo::Bar => {} + Foo::Var(Supertype::Bar) => {} + Foo::Var(Supertype::Var(x)) => {} + } +} + +fn main() {} |
