Skip to content

Commit 5994771

Browse files
committed
Add workaround for rust-lang#80108
1 parent 9b8cb18 commit 5994771

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

Diff for: crates/core_simd/src/macros.rs

+17-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,23 @@ macro_rules! impl_vector {
5252

5353
/// Converts a SIMD vector to an array.
5454
pub const fn to_array(self) -> [$type; LANES] {
55-
self.0
55+
// workaround for rust-lang/rust#80108
56+
// TODO fix this
57+
#[cfg(target_arch = "wasm32")]
58+
{
59+
let mut arr = [self.0[0]; LANES];
60+
let mut i = 0;
61+
while i < LANES {
62+
arr[i] = self.0[i];
63+
i += 1;
64+
}
65+
arr
66+
}
67+
68+
#[cfg(not(target_arch = "wasm32"))]
69+
{
70+
self.0
71+
}
5672
}
5773
}
5874

0 commit comments

Comments
 (0)