mirror of
https://github.com/rust-lang/rust.git
synced 2025-01-26 14:43:24 +00:00
add test for ICE failed to resolve instance for <[f32; 2] as CrossProduct
Fixes https://github.com/rust-lang/rust/issues/111667
This commit is contained in:
parent
012f9e26ac
commit
f483971b87
@ -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() {}
|
Loading…
Reference in New Issue
Block a user