You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
rustc has trouble recognizing legal {tuples,arrays} of pointers for #[repr(simd)] to use.
What Does Work
The following is an example of a vector-of-pointers type that works.
#![feature(repr_simd)]#[derive(Copy,Clone,Debug)]#[repr(simd)]pubstructptrx2<T>(T,T);fnmain(){let v = vec![2,3,4];let x = ptrx2(v.as_ptr(), v.as_ptr());}
Note that the pointer-ness here is only determined during monomorphization. This does not follow the same pattern as e.g. *const T being parameterized over <T>.
What Does Not Work
Attempts to define things like these give me errors.
I expected rustc to recognize a legal definition of a vector-of-pointers and proceed to monomorphize it.
Instead, this happened:
error[E0077]:SIMD vector element type should be a primitive scalar (integer/float/pointer) type
--> crates\core_simd\src\array.rs:76:1
|
76 | struct SimdConst<T,constLANES:usize>([*constT;LANES]);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
A parameter is accepted, but not a pointer, even though &T and *const T (but not &[T] or fn() -> ()) are valid inputs to that parameter (i.e. they monomorphize successfully).
The text was updated successfully, but these errors were encountered:
rustc has trouble recognizing legal {tuples,arrays} of pointers for
#[repr(simd)]
to use.What Does Work
The following is an example of a vector-of-pointers type that works.
Note that the pointer-ness here is only determined during monomorphization. This does not follow the same pattern as e.g.
*const T
being parameterized over<T>
.What Does Not Work
Attempts to define things like these give me errors.
or, in particular, the inciting incident:
I expected rustc to recognize a legal definition of a vector-of-pointers and proceed to monomorphize it.
Instead, this happened:
Meta
rustc --version --verbose
:Likely Causes
This is likely caused by the clauses in
rust/compiler/rustc_typeck/src/check/check.rs
Lines 1217 to 1222 in 7f9ab03
A parameter is accepted, but not a pointer, even though
&T
and*const T
(but not&[T]
orfn() -> ()
) are valid inputs to that parameter (i.e. they monomorphize successfully).The text was updated successfully, but these errors were encountered: