]> git.lizzy.rs Git - rust.git/commit - src/tools/rustfmt
Auto merge of #78863 - KodrAus:feat/simd-array, r=oli-obk
authorbors <bors@rust-lang.org>
Sun, 29 Nov 2020 09:28:09 +0000 (09:28 +0000)
committerbors <bors@rust-lang.org>
Sun, 29 Nov 2020 09:28:09 +0000 (09:28 +0000)
commit760430e6fdd70cdb09b5b6d696905c0ee0ea27c8
tree3807c43e5e80fb6daf02630212578b400258495a
parent3cbb56f80b2fbf5a3b405212665918dbffc44d39
parent354c7d0ab800f70e995383d498fc1fc420baa209
Auto merge of #78863 - KodrAus:feat/simd-array, r=oli-obk

Support repr(simd) on ADTs containing a single array field

This is a squash and rebase of `@gnzlbg's` #63531

I've never actually written code in the compiler before so just fumbled my way around until it would build ðŸ˜…

I imagine there'll be some work we need to do in `rustc_codegen_cranelift` too for this now, but might need some input from `@bjorn3` to know what that is.

cc `@rust-lang/project-portable-simd`

-----

This PR allows using `#[repr(simd)]` on ADTs containing a single array field:

```rust
 #[repr(simd)] struct S0([f32; 4]);
 #[repr(simd)] struct S1<const N: usize>([f32; N]);
 #[repr(simd)] struct S2<T, const N: usize>([T; N]);
```

This should allow experimenting with portable packed SIMD abstractions on nightly that make use of const generics.
compiler/rustc_codegen_llvm/src/intrinsic.rs
compiler/rustc_middle/src/ty/layout.rs
compiler/rustc_middle/src/ty/sty.rs
compiler/rustc_typeck/src/check/check.rs