forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add test for 88421 ICE: could not fully normalize `&<MyType as std::o…
…ps::Index<MyType>>::Output Fixes rust-lang#88421
- Loading branch information
1 parent
948ed37
commit f27b778
Showing
1 changed file
with
36 additions
and
0 deletions.
There are no files selected for viewing
36 changes: 36 additions & 0 deletions
36
tests/ui/const-generics/generic_const_exprs/failed-to-normalize-ice-issue-88421.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() {} |