about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--tests/ui/const-generics/generic_const_exprs/adt_wf_hang.rs14
-rw-r--r--tests/ui/const-generics/generic_const_exprs/adt_wf_hang.stderr18
2 files changed, 32 insertions, 0 deletions
diff --git a/tests/ui/const-generics/generic_const_exprs/adt_wf_hang.rs b/tests/ui/const-generics/generic_const_exprs/adt_wf_hang.rs
new file mode 100644
index 00000000000..5d538d2679d
--- /dev/null
+++ b/tests/ui/const-generics/generic_const_exprs/adt_wf_hang.rs
@@ -0,0 +1,14 @@
+#![feature(generic_const_exprs)]
+#![feature(adt_const_params)]
+#![allow(incomplete_features)]
+#![allow(dead_code)]
+
+#[derive(PartialEq, Eq)]
+struct U;
+
+struct S<const N: U>()
+where
+    S<{ U }>:;
+//~^ ERROR: overflow evaluating the requirement `S<{ U }> well-formed`
+
+fn main() {}
diff --git a/tests/ui/const-generics/generic_const_exprs/adt_wf_hang.stderr b/tests/ui/const-generics/generic_const_exprs/adt_wf_hang.stderr
new file mode 100644
index 00000000000..b244acb37dd
--- /dev/null
+++ b/tests/ui/const-generics/generic_const_exprs/adt_wf_hang.stderr
@@ -0,0 +1,18 @@
+error[E0275]: overflow evaluating the requirement `S<{ U }> well-formed`
+  --> $DIR/adt_wf_hang.rs:11:5
+   |
+LL |     S<{ U }>:;
+   |     ^^^^^^^^
+   |
+note: required by a bound in `S`
+  --> $DIR/adt_wf_hang.rs:11:5
+   |
+LL | struct S<const N: U>()
+   |        - required by a bound in this struct
+LL | where
+LL |     S<{ U }>:;
+   |     ^^^^^^^^ required by this bound in `S`
+
+error: aborting due to 1 previous error
+
+For more information about this error, try `rustc --explain E0275`.