diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:19:43 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:19:43 +0000 |
commit | 3e3e70d529d8c7d7c4d7bc4fefc9f109393b9245 (patch) | |
tree | daf049b282ab10e8c3d03e409b3cd84ff3f7690c /tests/ui/regions/higher-ranked-implied.rs | |
parent | Adding debian version 1.68.2+dfsg1-1. (diff) | |
download | rustc-3e3e70d529d8c7d7c4d7bc4fefc9f109393b9245.tar.xz rustc-3e3e70d529d8c7d7c4d7bc4fefc9f109393b9245.zip |
Merging upstream version 1.69.0+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/ui/regions/higher-ranked-implied.rs')
-rw-r--r-- | tests/ui/regions/higher-ranked-implied.rs | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/ui/regions/higher-ranked-implied.rs b/tests/ui/regions/higher-ranked-implied.rs new file mode 100644 index 000000000..103884c50 --- /dev/null +++ b/tests/ui/regions/higher-ranked-implied.rs @@ -0,0 +1,14 @@ +// FIXME: This test should pass as the first two fields add implied bounds that +// `'a` is equal to `'b` while the last one should simply use that fact. With +// the current implementation this errors. We have to be careful as implied bounds +// are only sound if they're also correctly checked. + +struct Inv<T>(*mut T); // `T` is invariant. +type A = for<'a, 'b> fn(Inv<&'a &'b ()>, Inv<&'b &'a ()>, Inv<&'a ()>); +type B = for<'a, 'b> fn(Inv<&'a &'b ()>, Inv<&'b &'a ()>, Inv<&'b ()>); + +fn main() { + let x: A = |_, _, _| (); + let y: B = x; //~ ERROR mismatched types + let _: A = y; //~ ERROR mismatched types +} |