summaryrefslogtreecommitdiffstats
path: root/tests/ui/const-generics/backcompat
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:19:13 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:19:13 +0000
commit218caa410aa38c29984be31a5229b9fa717560ee (patch)
treec54bd55eeb6e4c508940a30e94c0032fbd45d677 /tests/ui/const-generics/backcompat
parentReleasing progress-linux version 1.67.1+dfsg1-1~progress7.99u1. (diff)
downloadrustc-218caa410aa38c29984be31a5229b9fa717560ee.tar.xz
rustc-218caa410aa38c29984be31a5229b9fa717560ee.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.rs18
-rw-r--r--tests/ui/const-generics/backcompat/unevaluated-consts.rs18
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() {}