about summary refs log tree commit diff
diff options
context:
space:
mode:
authorBastian Kauschke <bastian_kauschke@hotmail.de>2020-07-15 15:14:33 +0200
committerBastian Kauschke <bastian_kauschke@hotmail.de>2020-07-15 15:15:43 +0200
commit526945915b3745168d192bcb2c7fb1428815a9bb (patch)
treec954a57b7fd8bff4adfa5fb3ca55b1f892070280
parent567ad7455d5f25f6b38d2fded1cb621e0c34a48b (diff)
downloadrust-526945915b3745168d192bcb2c7fb1428815a9bb.tar.gz
rust-526945915b3745168d192bcb2c7fb1428815a9bb.zip
add lazy normalization regression tests
-rw-r--r--src/test/ui/lazy_normalization_consts/trait-resolution-breakage.rs18
-rw-r--r--src/test/ui/lazy_normalization_consts/unevaluated-consts.rs18
2 files changed, 36 insertions, 0 deletions
diff --git a/src/test/ui/lazy_normalization_consts/trait-resolution-breakage.rs b/src/test/ui/lazy_normalization_consts/trait-resolution-breakage.rs
new file mode 100644
index 00000000000..df1c99e8671
--- /dev/null
+++ b/src/test/ui/lazy_normalization_consts/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/src/test/ui/lazy_normalization_consts/unevaluated-consts.rs b/src/test/ui/lazy_normalization_consts/unevaluated-consts.rs
new file mode 100644
index 00000000000..3f90d22ae2d
--- /dev/null
+++ b/src/test/ui/lazy_normalization_consts/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() {}