Skip to content

Commit f483971

Browse files
committed
add test for ICE failed to resolve instance for <[f32; 2] as CrossProduct
Fixes #111667
1 parent 012f9e2 commit f483971

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
// issue rust-lang/rust#111667
2+
// ICE failed to resolve instance for <[f32; 2] as CrossProduct ..
3+
//@ check-pass
4+
5+
#![feature(generic_const_exprs)]
6+
#![allow(incomplete_features)]
7+
8+
pub trait CrossProduct<'a, T, R> {
9+
fn cross(&'a self, t: &'a T) -> R;
10+
}
11+
12+
impl<'a, T, U, const N: usize> CrossProduct<'a, [U; N], [(&'a T, &'a U); N * N]> for [T; N] {
13+
fn cross(&'a self, us: &'a [U; N]) -> [(&'a T, &'a U); N * N] {
14+
std::array::from_fn(|i| (&self[i / N], &us[i % N]))
15+
}
16+
}
17+
18+
pub fn main() {}

0 commit comments

Comments
 (0)