Skip to content

Commit

Permalink
add test for 88421 ICE: could not fully normalize `&<MyType as std::o…
Browse files Browse the repository at this point in the history
…ps::Index<MyType>>::Output

Fixes rust-lang#88421
  • Loading branch information
matthiaskrgr committed Mar 22, 2024
1 parent c7ef3cd commit 3c1db06
Showing 1 changed file with 36 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -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() {}

0 comments on commit 3c1db06

Please sign in to comment.