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 ICE failed to resolve instance for <[f32; 2] as CrossPro…
…duct Fixes rust-lang#111667
- Loading branch information
1 parent
0495f8f
commit bced44c
Showing
1 changed file
with
18 additions
and
0 deletions.
There are no files selected for viewing
18 changes: 18 additions & 0 deletions
18
tests/ui/const-generics/generic_const_exprs/failed-to-resolve-instance-ice-111667.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,18 @@ | ||
// issue rust-lang/rust#111667 | ||
// ICE failed to resolve instance for <[f32; 2] as CrossProduct .. | ||
//@ check-pass | ||
|
||
#![feature(generic_const_exprs)] | ||
#![allow(incomplete_features)] | ||
|
||
pub trait CrossProduct<'a, T, R> { | ||
fn cross(&'a self, t: &'a T) -> R; | ||
} | ||
|
||
impl<'a, T, U, const N: usize> CrossProduct<'a, [U; N], [(&'a T, &'a U); N * N]> for [T; N] { | ||
fn cross(&'a self, us: &'a [U; N]) -> [(&'a T, &'a U); N * N] { | ||
std::array::from_fn(|i| (&self[i / N], &us[i % N])) | ||
} | ||
} | ||
|
||
pub fn main() {} |