Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add build-fail test for simd type with an element type that's a wide pointer #1

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
// run-pass
// ignore-emscripten

#![feature(extern_types)]
#![feature(repr_simd)]

use std::ptr::NonNull;

extern {
type Extern;
}

#[repr(simd)]
struct S<T>(T);

#[inline(never)]
fn identity<T>(v: T) -> T {
v
}

fn main() {
let _v: S<[Option<NonNull<Extern>>; 4]> = identity(S([None; 4]));
}
12 changes: 12 additions & 0 deletions src/test/ui/simd/simd-type-generic-monomorphisation-wide-ptr.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
// build-fail

#![feature(repr_simd)]

// error-pattern:monomorphising SIMD type `S<[*mut [u8]; 4]>` with a non-primitive-scalar (integer/float/pointer) element type `*mut [u8]`

#[repr(simd)]
struct S<T>(T);

fn main() {
let _v: Option<S<[*mut [u8]; 4]>> = None;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
error: monomorphising SIMD type `S<[*mut [u8]; 4]>` with a non-primitive-scalar (integer/float/pointer) element type `*mut [u8]`

error: aborting due to previous error

12 changes: 12 additions & 0 deletions src/test/ui/simd/simd-type-wide-ptr.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
// build-fail

#![feature(repr_simd)]

// error-pattern:monomorphising SIMD type `S` with a non-primitive-scalar (integer/float/pointer) element type `*mut [u8]`

#[repr(simd)]
struct S([*mut [u8]; 4]);

fn main() {
let _v: Option<S> = None;
}
4 changes: 4 additions & 0 deletions src/test/ui/simd/simd-type-wide-ptr.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
error: monomorphising SIMD type `S` with a non-primitive-scalar (integer/float/pointer) element type `*mut [u8]`

error: aborting due to previous error