about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--tests/ui/const-generics/generic_const_exprs/failed-to-normalize-ice-issue-88421.rs36
1 files changed, 36 insertions, 0 deletions
diff --git a/tests/ui/const-generics/generic_const_exprs/failed-to-normalize-ice-issue-88421.rs b/tests/ui/const-generics/generic_const_exprs/failed-to-normalize-ice-issue-88421.rs
new file mode 100644
index 00000000000..2ea7394fb72
--- /dev/null
+++ b/tests/ui/const-generics/generic_const_exprs/failed-to-normalize-ice-issue-88421.rs
@@ -0,0 +1,36 @@
+//@ check-pass
+
+#![feature(adt_const_params)]
+#![feature(generic_const_exprs)]
+#![allow(incomplete_features)]
+
+use std::ops::Index;
+
+pub struct CellPossibilities;
+
+pub enum CellState<const SQUARE_SIZE: usize> {
+    Empty(Option<CellPossibilities>),
+}
+
+pub struct Sudoku<const SQUARE_SIZE: usize>;
+
+impl<const SQUARE_SIZE: usize> Sudoku<SQUARE_SIZE>where
+    [CellState<SQUARE_SIZE>; SQUARE_SIZE * SQUARE_SIZE]: Sized,
+{
+    pub fn random() {
+        let CellState::Empty(_) = Self[()];
+    }
+}
+
+impl<const SQUARE_SIZE: usize> Index<()> for Sudoku<SQUARE_SIZE>
+where
+    [CellState<SQUARE_SIZE>; SQUARE_SIZE * SQUARE_SIZE]: Sized,
+{
+    type Output = CellState<SQUARE_SIZE>;
+
+    fn index(&self, _: ()) -> &Self::Output {
+        todo!()
+    }
+}
+
+pub fn main() {}