Skip to content

Commit 1adf6ca

Browse files
committed
Test case to ensure functions that take scalable vectors don't impl Fn.
1 parent e23a944 commit 1adf6ca

File tree

2 files changed

+33
-0
lines changed

2 files changed

+33
-0
lines changed

tests/ui/simd/scalable/no-fn-trait.rs

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#![feature(repr_simd, repr_scalable)]
2+
3+
#[repr(simd, scalable(4))]
4+
pub struct ScalableSimdFloat {
5+
_ty: [f32],
6+
}
7+
8+
unsafe fn test<T>(f: T)
9+
where
10+
T: Fn(ScalableSimdFloat), //~ ERROR E0277
11+
{
12+
}
13+
14+
fn main() {}
+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
error[E0277]: the size for values of type `[f32]` cannot be known at compilation time
2+
--> $DIR/no-fn-trait.rs:10:8
3+
|
4+
LL | T: Fn(ScalableSimdFloat),
5+
| ^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
6+
|
7+
= help: within `(ScalableSimdFloat,)`, the trait `Sized` is not implemented for `[f32]`, which is required by `(ScalableSimdFloat,): Sized`
8+
note: required because it appears within the type `ScalableSimdFloat`
9+
--> $DIR/no-fn-trait.rs:4:12
10+
|
11+
LL | pub struct ScalableSimdFloat {
12+
| ^^^^^^^^^^^^^^^^^
13+
= note: required because it appears within the type `(ScalableSimdFloat,)`
14+
note: required by an implicit `Sized` bound in `Fn`
15+
--> $SRC_DIR/core/src/ops/function.rs:LL:COL
16+
17+
error: aborting due to 1 previous error
18+
19+
For more information about this error, try `rustc --explain E0277`.

0 commit comments

Comments
 (0)