Skip to content

future-incompat: use of SIMD types aren't gated properly #87438

Closed
@JohnTitor

Description

@JohnTitor

(Splitting from https://github.com/rust-lang/rust/pull/59238/files/8477a04a72a6f8e0adb46be91a2628b07648c200#r266976217)

Consider the following (playground):

use std::arch::x86_64::__m128;

#[allow(improper_ctypes)]
extern "C" {
    fn e(x: __m128);
}

which produces the following error (correctly):

error: use of SIMD type `__m128` in FFI is highly experimental and may result in invalid code
 --> src/lib.rs:5:13
  |
5 |     fn e(x: __m128);
  |             ^^^^^^
  |
  = help: add `#![feature(simd_ffi)]` to the crate attributes to enable

But when we use it on struct (playground):

#[repr(transparent)] pub struct A(__m128);
#[repr(C)] pub struct B(__m128);

it just compiles fine on stable Rust, while we should gate it. We should eventually disallow it through a future incompat lint.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-FFIArea: Foreign function interface (FFI)A-SIMDArea: SIMD (Single Instruction Multiple Data)C-bugCategory: This is a bug.F-simd_ffi`#![feature(simd_ffi)]`T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions