diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:19:03 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:19:03 +0000 |
commit | 64d98f8ee037282c35007b64c2649055c56af1db (patch) | |
tree | 5492bcf97fce41ee1c0b1cc2add283f3e66cdab0 /tests/ui/const-generics/backcompat | |
parent | Adding debian version 1.67.1+dfsg1-1. (diff) | |
download | rustc-64d98f8ee037282c35007b64c2649055c56af1db.tar.xz rustc-64d98f8ee037282c35007b64c2649055c56af1db.zip |
Merging upstream version 1.68.2+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/ui/const-generics/backcompat')
-rw-r--r-- | tests/ui/const-generics/backcompat/trait-resolution-breakage.rs | 18 | ||||
-rw-r--r-- | tests/ui/const-generics/backcompat/unevaluated-consts.rs | 18 |
2 files changed, 36 insertions, 0 deletions
diff --git a/tests/ui/const-generics/backcompat/trait-resolution-breakage.rs b/tests/ui/const-generics/backcompat/trait-resolution-breakage.rs new file mode 100644 index 000000000..df1c99e86 --- /dev/null +++ b/tests/ui/const-generics/backcompat/trait-resolution-breakage.rs @@ -0,0 +1,18 @@ +// check-pass + +trait Trait<T> { + const ASSOC_CONST: usize = 0; +} + +impl Trait<()> for u8 {} + +// `u8::ASSOC_CONST` is resolved today, but will be ambiguous +// under lazy normalization. +fn foo<T, U>() -> [(T, U); u8::ASSOC_CONST] +where + u8: Trait<T> + Trait<U>, +{ + todo!() +} + +fn main() {} diff --git a/tests/ui/const-generics/backcompat/unevaluated-consts.rs b/tests/ui/const-generics/backcompat/unevaluated-consts.rs new file mode 100644 index 000000000..3f90d22ae --- /dev/null +++ b/tests/ui/const-generics/backcompat/unevaluated-consts.rs @@ -0,0 +1,18 @@ +// check-pass + +// If we allow the parent generics here without using lazy normalization +// this results in a cycle error. +struct Foo<T, U>(T, U); + +impl<T> From<[u8; 1 + 1]> for Foo<T, [u8; 1 + 1]> { + fn from(value: [u8; 1 + 1]) -> Foo<T, [u8; 1 + 1]> { + todo!(); + } +} + +fn break_me<T>() +where + [u8; 1 + 1]: From<[u8; 1 + 1]> +{} + +fn main() {} |